Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/143.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Eclipse内容辅助功能不支持';无法识别std::thread,但编译正确_C++_Eclipse_Ubuntu_Eclipse Cdt_Stdthread - Fatal编程技术网

C++ Eclipse内容辅助功能不支持';无法识别std::thread,但编译正确

C++ Eclipse内容辅助功能不支持';无法识别std::thread,但编译正确,c++,eclipse,ubuntu,eclipse-cdt,stdthread,C++,Eclipse,Ubuntu,Eclipse Cdt,Stdthread,我正在运行Ubuntu 14.04 我采取的复制步骤: > p>创建一个新的C++项目(new -C++ ++ -Hello World Project),我称之为代码> TestSTdToS/ 将主文件中的代码更改为: #include <thread> #include <iostream> int main() { std::cout << "You have " << std::thread::hardware_concurr

我正在运行Ubuntu 14.04

我采取的复制步骤:

> p>创建一个新的C++项目(new -C++ ++ -Hello World Project),我称之为代码> TestSTdToS/<代码>

  • 将主文件中的代码更改为:

    #include <thread>
    #include <iostream>
    
    int main() {
        std::cout << "You have " << std::thread::hardware_concurrency() << " cores." << std::endl;
        return 0;
    }
    

    转到
    项目
    ->
    属性
    ->
    C/C++常规
    ->
    预处理器包含路径等
    ->
    提供程序
    ->并将
    -std=C++11
    附加到编译器规范中

    您还可以对所有进入
    窗口
    ->
    首选项
    ->
    C/C++
    ->
    构建
    ->
    设置
    ->
    发现
    并将
    -std=C++11
    附加到
    CDT GCC内置编译器设置
    规范的项目执行此操作

    确保之后重新编制项目索引


    这些说明适用于Eclipse Luna(4.4.0),对于以前的版本,路径类似。

    \35;包括
    maybe?@vsoftco哎呀,这是一个复制/粘贴错误。当然,在我的原始代码中确实有;)尝试重新索引该项目。@vsoftco尝试过;它仍然不工作。在我的工作(<代码> OS x/COD>代码> GCC 4.9 < /C>),没有红色标记,但是我在ProjtProjt/C++Budi/C++ /GC/C++编译器/杂项(其他标志)下添加了<代码> -STD= C++ 11 标志,但我猜它不应该有任何区别。
    llama@llama-Satellite-E55-A:/usr$ find -name "*pthread*" -not -path "./share/*"
    ./include/pthread.h
    ./include/x86_64-linux-gnu/bits/pthreadtypes.h
    ./lib/x86_64-linux-gnu/pkgconfig/pthread-stubs.pc
    ./lib/x86_64-linux-gnu/libpthread.so
    ./lib/x86_64-linux-gnu/libpthread_nonshared.a
    ./lib/x86_64-linux-gnu/libgpgme-pthread.so.11.11.0
    ./lib/x86_64-linux-gnu/libgpgme-pthread.so.11
    ./lib/x86_64-linux-gnu/libpthread.a
    ./lib/perl/5.18.2/bits/pthreadtypes.ph
    ./lib/debug/lib/x86_64-linux-gnu/libpthread-2.19.so