[英]Eclipse CDT: Unresolved inclusion of stl header
I'm trying to use Eclipse to edit sources, compiled under C++ Builder, but stuck with Unresolved inclusion
problem. 我正在尝试使用Eclipse编辑源代码,在C ++ Builder下编译,但仍然存在
Unresolved inclusion
问题。
For example, code like: 例如,代码如:
#include <vector>
Gives Unresolved inclusion: <vector>
error in Eclipse IDE. 给出了
Unresolved inclusion: <vector>
Eclipse IDE中的Unresolved inclusion: <vector>
错误。 C++ Builder indeed has no vector
file, instead it has vector.h
which is used by compiler. C ++ Builder确实没有
vector
文件,而是有编译器使用的vector.h
。
Eclipse IDE gives no error if I write 如果我写的话Eclipse IDE没有错误
#include <vector.h>
How do I tell Eclipse to use vector.h
when it sees #include <vector>
? 当它看到
#include <vector>
时,如何告诉Eclipse使用vector.h
?
This allowed me to avoid Eclipse "Unresolved inclusion" error. 这让我避免了Eclipse“Unresolved inclusion”错误。
In my case I had to find the location of the C++ vector header on my computer (which is a Mac): 在我的情况下,我必须在我的计算机(这是一台Mac)上找到C ++矢量标题的位置:
find /usr/local -name vector -print
I found the correct include location in folder "/usr/include/c++/4.2.1". 我在文件夹“/usr/include/c++/4.2.1”中找到了正确的包含位置。 Then I set my project eclipse settings like so:
然后我设置我的项目eclipse设置如下:
Project->Properties->C/C++ General->Paths and Symbols->GNU C++->(Add)->"/usr/include/c++/4.2.1"
I'm not using C++ Builder, but my solution might address part of your trouble. 我没有使用C ++ Builder,但我的解决方案可能会解决您的部分麻烦。
You could also try use "CDT GCC Built-in Compiler Settings". 您也可以尝试使用“CDT GCC内置编译器设置”。 Go to the project properties > C/C++ General > Preprocessor Include Path > Providers tab then check "CDT GCC Built-in Compiler Settings" if it is not.
转到项目属性> C / C ++常规>预处理器包含路径>提供程序选项卡,然后选中“CDT GCC内置编译器设置”(如果不是)。
None of the other solutions (play with include path, etc) worked for me for the type 'string', but this one fixed it. 没有其他解决方案(使用包含路径等)为我的类型'字符串'工作,但这个解决了它。
On Windows, with Eclipse CDT Oxygen, none of the solutions described here worked for me (including the "Provider" - "CDT GCC Built-in Compiler Settings"). 在Windows上,使用Eclipse CDT Oxygen,此处描述的解决方案都不适用于我(包括“提供程序” - “CDT GCC内置编译器设置”)。 What works for me is:
对我有用的是:
memory and memory.h don't refer to the same source. memory和memory.h不是指同一个源。
One is for c, the other for c++ 一个用于c,另一个用于c ++
Do you have the right includes source in your project settings ? 您是否在项目设置中拥有正确的包含来源?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.