[Qt-creator] C++11 (e.g. std::thread) and code-completion in qtcreator

Roberto Raggi roberto.raggi at nokia.com
Mon Dec 12 15:49:52 CET 2011


On 12/12/2011 05:40 AM, ext Wilhelm wrote:
> Hi all,
>
> the minimal example below compiles/executes fine, but I'm missing the
> code-completion features of qtcreator: e.g. writing
>
> t.j<Ctrl-Space>
>
> doesn't show any code-completions.
>
> What am I missing here?

current versions of Qt Creator have very little support for C++11, if 
you don't use much of c++11 (and your tool chain is gcc-based) you can 
apply the attached patch to enable what we have.

ciao robe



diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp 
b/src/plugins/projectexplorer/gcctoolchain.cpp
index 2cc25bd..a4eaa73 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -99,6 +99,7 @@ static QByteArray gccPredefinedMacros(const QString 
&gcc, const QStringList &env
  {
      QStringList arguments;
      arguments << QLatin1String("-xc++")
+ << QLatin1String("-std=c++0x")
<< QLatin1String("-E")
<< QLatin1String("-dM")
<< QLatin1String("-");


>
> ---
>
> #include<iostream>
> #include<thread>
>
> void hello()
> {
>        std::cout<<  "Hello"<<  std::endl;
> }
>
> int main() {
>        std::thread t(hello);
>
>        t.join();
>
>        return 0;
> }
>




More information about the Qt-creator mailing list