Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/132.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
“多重”;“无法解决”;使用Eclipse和minGW时出现的问题 我最近安装了(最新的)C++C++开发人员的Eclipse IDE和MIWW(4.8),帮助我在很长一段时间后回到C++。 < >我在代码< > C/C++构建/设置/工具设置/ GCC C++编译器/杂项< /代码> < /P>中添加了 -STD= C++ 11 到其他标志 >_C++_Eclipse_Gcc_C++11_Mingw32 - Fatal编程技术网

“多重”;“无法解决”;使用Eclipse和minGW时出现的问题 我最近安装了(最新的)C++C++开发人员的Eclipse IDE和MIWW(4.8),帮助我在很长一段时间后回到C++。 < >我在代码< > C/C++构建/设置/工具设置/ GCC C++编译器/杂项< /代码> < /P>中添加了 -STD= C++ 11 到其他标志 >

“多重”;“无法解决”;使用Eclipse和minGW时出现的问题 我最近安装了(最新的)C++C++开发人员的Eclipse IDE和MIWW(4.8),帮助我在很长一段时间后回到C++。 < >我在代码< > C/C++构建/设置/工具设置/ GCC C++编译器/杂项< /代码> < /P>中添加了 -STD= C++ 11 到其他标志 >,c++,eclipse,gcc,c++11,mingw32,C++,Eclipse,Gcc,C++11,Mingw32,我有一个小程序,利用了许多C++11功能(例如,使用chrono库,.emplace\u back) 运行后,我在“问题”窗口中获得多个未解决的问题,如下所示) 有趣的是,该程序确实编译并运行正常 有了这些,我是否没有在Eclipse中设置一些东西来解决这些问题 是否有人知道minGW(4.8.1)中的to_string()函数是否仍然存在问题,例如,以下内容未编译: window.setTitle("Bullets on screen: " + to_string(bullets.size()

我有一个小程序,利用了许多C++11功能(例如,使用
chrono
库,
.emplace\u back

运行后,我在“问题”窗口中获得多个未解决的问题,如下所示)

有趣的是,该程序确实编译并运行正常

  • 有了这些,我是否没有在Eclipse中设置一些东西来解决这些问题

  • 是否有人知道minGW(4.8.1)中的
    to_string()
    函数是否仍然存在问题,例如,以下内容未编译:

    window.setTitle("Bullets on screen: " + to_string(bullets.size()) + " currentSlice: " + to_string(currentSlice) + " FT: " + to_string(ft) + " FPS: " + to_string(fps) );
    
    它确实使用Visual Studio Express 2013进行编译(尽管它在
    chrono
    库的准确性方面存在问题,因此需要切换到minGW)

    谢谢

  • Eclipse“问题”窗口输出:

    Description Resource Path Location Type
     Symbol 'duration' could not be resolved chronotest.cpp /chronotest/src line 19 Semantic Error
     Function 'now' could not be resolved Test2.cpp /Test2/src line 143 Semantic Error
     Function 'duration_cast' could not be resolved Test2.cpp /Test2/src line 160 Semantic Error
     Function 'now' could not be resolved Test2.cpp /Test2/src line 158 Semantic Error
     Symbol 'chrono' could not be resolved Test2.cpp /Test2/src line 8 Semantic Error
     Type 'std::centi' could not be resolved chronotest.cpp /chronotest/src line 20 Semantic Error
     Type 'std::chrono::seconds' could not be resolved chronotest.cpp /chronotest/src line 24 Semantic Error
     Type 'std::time_t' could not be resolved chronotest.cpp /chronotest/src line 48 Semantic Error
     Symbol 'duration' could not be resolved chronotest.cpp /chronotest/src line 47 Semantic Error
     Function 'now' could not be resolved chronotest.cpp /chronotest/src line 44 Semantic Error
     Function 'now' could not be resolved chronotest.cpp /chronotest/src line 39 Semantic Error
     Type 'std::chrono::system_clock' could not be resolved chronotest.cpp /chronotest/src line 38 Semantic Error
     Function 'end' could not be resolved Test2.cpp /Test2/src line 214 Semantic Error
     Symbol 'time_point' could not be resolved chronotest.cpp /chronotest/src line 38 Semantic Error
     Function 'end' could not be resolved Test2.cpp /Test2/src line 212 Semantic Error
     Type 'milli' could not be resolved Test2.cpp /Test2/src line 161 Semantic Error
     Method 'count' could not be resolved Test2.cpp /Test2/src line 161 Semantic Error
     Symbol 'duration_cast' could not be resolved Test2.cpp /Test2/src line 160 Semantic Error
     Symbol 'duration' could not be resolved Test2.cpp /Test2/src line 161 Semantic Error
     Method 'count' could not be resolved chronotest.cpp /chronotest/src line 51 Semantic Error
     Symbol 'duration_cast' could not be resolved chronotest.cpp /chronotest/src line 30 Semantic Error
     Method 'count' could not be resolved chronotest.cpp /chronotest/src line 30 Semantic Error
     Function 'to_time_t' could not be resolved chronotest.cpp /chronotest/src line 48 Semantic Error
     Method 'count' could not be resolved chronotest.cpp /chronotest/src line 32 Semantic Error
     Function 'ctime' could not be resolved chronotest.cpp /chronotest/src line 50 Semantic Error
     Method 'count' could not be resolved chronotest.cpp /chronotest/src line 33 Semantic Error
     Symbol 'duration' could not be resolved chronotest.cpp /chronotest/src line 22 Semantic Error
     Invalid arguments '
     Candidates are:
     __gnu_cxx::__normal_iterator<Bullet *,std::vector<Bullet,std::allocator<Bullet>>> erase(__gnu_cxx::__normal_iterator<Bullet *,std::vector<Bullet,std::allocator<Bullet>>>)
     __gnu_cxx::__normal_iterator<Bullet *,std::vector<Bullet,std::allocator<Bullet>>> erase(__gnu_cxx::__normal_iterator<Bullet *,std::vector<Bullet,std::allocator<Bullet>>>, __gnu_cxx::__normal_iterator<Bullet *,std::vector<Bullet,std::allocator<Bullet>>>)
     ' Test2.cpp /Test2/src line 212 Semantic Error
     Symbol 'ratio' could not be resolved chronotest.cpp /chronotest/src line 22 Semantic Error
     Invalid arguments '
     Candidates are:
     #0 remove_if(#0, #0, #1)
     ' Test2.cpp /Test2/src line 212 Semantic Error
     Symbol 'duration_cast' could not be resolved chronotest.cpp /chronotest/src line 28 Semantic Error
     Method 'count' could not be resolved chronotest.cpp /chronotest/src line 28 Semantic Error
     Method 'emplace_back' could not be resolved Test2.cpp /Test2/src line 191 Semantic Error
     Symbol 'ratio' could not be resolved chronotest.cpp /chronotest/src line 19 Semantic Error
     Symbol 'duration' could not be resolved chronotest.cpp /chronotest/src line 20 Semantic Error
     Symbol 'duration' could not be resolved chronotest.cpp /chronotest/src line 21 Semantic Error
     Function 'begin' could not be resolved Test2.cpp /Test2/src line 212 Semantic Error
     Symbol 'ratio' could not be resolved chronotest.cpp /chronotest/src line 21 Semantic Error
    

    转到
    项目->属性->C/C++常规->预处理器包括路径、宏等->提供程序->CDT GCC内置编译器设置
    ,停用
    使用项目间共享的全局提供程序
    ,并添加命令行参数
    -std=C++11

    eclipse实时代码分析与构建编译器不共享相同的设置。您还可以在
    Window->Preferences->C/C++->Build->Settings->CDT GCC内置编译器设置中全局更改设置(不仅仅针对项目)


    编辑:您需要
    #包括
    才能使用
    std::to_string

    从以下位置重新下载
    gcc
    编译器:

    http://www.equation.com/servlet/equation.cmd?fa=fortran
    
    将它安装在
    c:\minGW
    文件夹中使用新的worksapce/fresh eclipse设置,它工作起来很有魅力

    在尝试、重新构建和设置之前,不要忘记重新启动

    < >同时设置<代码> MinGW <代码>作为默认工具链Windows >首选项>新C++ > ->将
    MinMG
    设置为首选工具链


    如果您无法在列表中看到它,请在创建项目时取消选择“显示项目类型…”。

    我将在@Nabla和@Enissey给出的答案中添加一些细节

    添加命令行参数时,例如,在全局首选项中添加CDT GCC内置编译器设置Cygwin

    ${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"
    
    这样做,

    ${COMMAND} ${FLAGS} -E -P -v -dD -std=c++11 "${INPUTS}"
    
    要执行此操作,请右键单击项目,进入“索引”子菜单下,然后选择“重建”


    在我的例子中,我进行了全局更改并重建了索引。

    非常感谢这一点-大多数涉及引用的解析器问题现在已经解决。“to_字符串”问题仍然存在。抱歉没有在此处包含错误详细信息。我编辑了我的原始问题以包含这些错误。@Jim我将这些错误添加到了我的答案中。在谷歌搜索了很多次之后,我发现为了让“to_string”函数在minGW中工作,您(目前)必须使用minGW w64 fork下载(在阅读链接后,例如使用中的链接)。希望这对其他人有所帮助。同样需要注意的是,这适用于“LinuxGCC”工具链。我曾愚蠢地尝试使用“Cross GCC”,但失败惨重。我拥有了第一部分,但仍然无法识别
    array
    ,即使代码执行正确!!!所以你答案的第二部分解决了这个问题:(也在后面重建索引!!!)参见
    ${COMMAND} ${FLAGS} -E -P -v -dD -std=c++11 "${INPUTS}"