I cannot compile helloworld.cpp with eclipse & CDT on mac

左心房为你撑大大i 提交于 2019-12-13 18:43:02

问题


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;

}

回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/9315386/i-cannot-compile-helloworld-cpp-with-eclipse-cdt-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!