как cinfig CDT (mars) с GCC5.1, чтобы решить & quot; std :: thread & quot; условное обозначение?

Моя главная операционная система:

Fedora 22 x64

Версия gcc-g ++:

5.1.1

затмение cdt версия:

Eclipse CDT Mars Release V4.5.0

вот мой простой список демонстрационных кодов:

#include <thread>
void func(){}

int main(int argc, char** argv)
{
std::thread ts(func);
ts.join();
return 0;
}

и это мой конфиг cdt (неправильный конфиг):

Project Properties->C/C++Build->Tool Chain Editor->(use Linux GCC as current)
Project Properties->C/C++Build->Settings->GCC C++ Compiler->Dialet->(ISO C++11)
Project Properties->C/C++Build->Settings->GCC C Compiler->Dialet->(ISO C11)
Project Properties->C/C++Build->Settings->GCC C++ Linker->(add pthread)

Project Properties->C/C++General->Paths and Symbols->Symbols
->add '__GXX_EXPERIMENTAL_CXX0X__' to GNU C++

Project Properties->C/C++General->PreprocessorIncludePaths,Macros etc.->Providers
->(Select only 'CDT GCC Built-in Compiler Settings' and add'-std=c++11' to command)

результат:

the project can build and run successfully
but eclipse CDT always show error: Symbol 'thread' could not be resolved

0

Решение

std::thread ts(func); может рассматриваться как определение функции. использование std::thread ts{func}; вместо. Также темы нужны -pthread настройка для компилятора / компоновщика — как: g++ -std=c++11 -pthread prog.cpp,

0

Другие решения


По вопросам рекламы ammmcru@yandex.ru
Adblock
detector