我无法使用 eclipse & 编译 helloworld.cpp Mac 上的 CDT
编译器说: 无法解析符号“std” 无法解析符号“cout” 符号'endl'无法解析
它似乎是一个C编译器,但我确实安装了CDT中列出的所有内容。
我尝试搜索,但都是关于 Windows 的。我已经安装了 CDT 中的所有插件。
奇怪的是,该文件曾经编译并打印过“Hello world”。我不明白发生了什么事。
我的操作系统是 osx lion (10.7.3)。希望有人能帮助我!谢谢!
我的eclipse版本是3.7。 我的cdt版本是8.0.0。
这是 helloworld.cpp 的代码
#include <iostream>
using namespace std;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}
compiler says:
Symbol 'std' could not be resolved
Symbol 'cout' could not be resolved
Symbol 'endl' could not be resolved
It seems that it is a C compiler, but I really installed everything listed in CDT.
I tried searching but it's all about windows. I've installed all the plugins in CDT.
Something strange is that the file was once compiled and printed "Hello world". I can't understand what is happening.
My os is osx lion (10.7.3). Hope someone can help me! Thanks!
My eclipse version is 3.7.
My cdt version is 8.0.0.
Here's the code for helloworld.cpp
#include <iostream>
using namespace std;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Eclipse 可能很难导航。您能否剪切并粘贴您的 helloworld.cpp 以及您所遵循的 Eclipse 说明的链接?
编辑:
K,看来它没有将该文件识别为 c++。您可能想确保您是从 C++ 项目开始的。另外,许多 Windows Eclipse 问题也应该对您有所帮助。
Eclipse can be quite difficult to navigate. Can you cut 'n' paste your helloworld.cpp and the links to the Eclipse instructions you followed?
Edit:
K, It appears that it's not recognizing the file as c++. You may want to make sure you started with a c++ project. Also, many of the windows eclipse problems should help you as well.
我通过用旧版本的 Helios 替换 Indigo 解决了这个问题,并且工作正常。希望有人能够在不改变 Eclipse 版本的情况下提出其他解决问题的方法。
I fixed this by replace Indigo with an older version Helios, and it's working fine. Hope someone can come up with other approaches to the problem without changing Eclipse version.