多个“无法解析”使用Eclipse和minGW的问题 [英] Multiple "could not be resolved" problems using Eclipse with minGW
问题描述
我最近安装了(最新的版本)用于C / C ++开发人员的Eclipse IDE和minGW(4.8.1),以帮助我在很长时间后恢复到C ++。
I have recently installed (the latest builds of) 'Eclipse IDE for C/C++ Developers' and minGW (4.8.1) to help me to get back into C++ after a long time away.
我已将 -std = c ++ 11 添加到
其他标志
在 C / C ++编译/设置/工具设置/ GCC C ++编译器/其他
我有一个小程序, C ++ 11功能(例如使用 chrono
库, .emplace_back
)。
I have a small program utilizing a number of C++11 features (e.g. using the chrono
library, .emplace_back
).
运行后,我在问题窗口中遇到多个未解决的问题,如下面的粘贴。)
After Run I get multiple unresolved issues in the Problems window, as Pasted below).
有趣的是,程序编译并运行确定。
Interestingly, the program does compile and run ok.
-
有了这个,我在Eclipse中没有设置来解决这些问题吗?
With this, is there something I'm not setting up in Eclipse to resolve these issues?
有没有人知道在minGW(4.8.1)中 to_string()
以下不编译:
Does anyone know if there still an issue with the to_string()
function in minGW (4.8.1) e.g. the following does not compile:
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编译(虽然它有一个问题, c $ c> chrono 库,因此切换到minGW)。
It does compile using Visual Studio Express 2013 (though it has an issue with the accuracy of the chrono
library, hence the switch to minGW).
谢谢。
Eclipse'Problem'窗口输出:
Eclipse 'Problem' window output:
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
:对于不包含剩余to_string的错误详细信息,请参考。 Eclipse'Problem'窗口输出如下:
: Apologies for not including error details for the remaining "to_string". The Eclipse 'Problem' window output has the following:
Description Resource Path Location Type
'to_string' was not declared in this scope Test2.cpp /Test2/src line 170 C/C++ Problem
Function 'to_string' could not be resolved Test2.cpp /Test2/src line 170 Semantic Error
Function 'to_string' could not be resolved Test2.cpp /Test2/src line 170 Semantic Error
unused variable 'currentSlice' [-Wunused-variable] Test2.cpp /Test2/src line 125 C/C++ Problem
Function 'to_string' could not be resolved Test2.cpp /Test2/src line 170 Semantic Error
Invalid arguments '
Candidates are:
void setTitle(const sf::String &)
' Test2.cpp /Test2/src line 170 Semantic Error
Function 'to_string' could not be resolved Test2.cpp /Test2/src line 170 Semantic Error
推荐答案
转到 Project - >属性 - > C / C ++ General - >预处理器包括路径,宏等 - >提供者 - > CDT GCC内置编译器设置
,停用使用项目之间共享的全局提供程序
并添加命令行参数 -std = c ++ 11
。
Go to Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros, etc. -> Providers -> CDT GCC built-in compiler settings
, deactivate Use global provider shared between projects
and add the command line argument -std=c++11
.
eclipse实时代码分析与构建编译器不共享相同的设置。您还可以在 Window - >中全局更改设置(不仅仅是项目)偏好设置 - > C / C ++ - >构建 - >设置 - > CDT GCC内置编译器设置
。
The eclipse live code analysis does not share the same settings with the build compiler. You can also change the setting globally (not just for the project) in Window -> Preferences -> C/C++ -> Build -> Settings -> CDT GCC Built-in Compiler Settings
.
编辑:您需要 #include< string>
使用 std :: to_string
。
这篇关于多个“无法解析”使用Eclipse和minGW的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!