使得C ++在Eclipse中编译 [英] Getting C++ to compile inside Eclipse
问题描述
尝试获取Eclipse CDT插件来编译一个简单的C ++应用程序。我创建一个新的C ++项目,并添加1个文件( test.cpp
),并将其编码为一个你好,世界!示例:
Trying to get Eclipse CDT plugin to compile a simple C++ app. I create a new C++ project, and add 1 file (test.cpp
) and code it up like a "Hello, world!" example:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, world!";
return 0;
}
使用命名空间std 和 cout
(分别):
I get highlighted syntax errors on using namespace std
and cout
, stating (respectively):
符号'std'无法解决
无法解析符号'cout'
Symbol 'std' could not be resolved Symbol 'cout' could not be resolved
我确定我没有安装CDT需要编译/构建一个完整的C ++应用程序所需的一切。
I'm sure I didn't install CDT with everything it needed to compile/build a full C++ app. Where could I start looking to figure out what I'm missing?
推荐答案
你有编译器吗?
引用 eclipse文档:Eclipse IDE for C / C ++开发人员不包含编译器或调试器;如果你的系统没有一个,你需要下载并安装一个。请参阅之前您可以在C / C ++开发用户指南的开始部分。
Do you have a compiler? Quoting eclipse documentation: 'Eclipse IDE for C/C++ Developers does not contain a compiler or debugger; if your system does not have one, you need to download and install one. Please see the Before you begin section of the C/C++ Development User Guide.'
您可以选择并找到如何安装编译器。
There you can choose and find out how to install a compiler.
对于未解析的符号问题,需要在Project-> Properties-> C / C ++ General-> Paths和Symbols / Includes选项卡中设置正确的路径,这取决于编译器选择安装。
Specifically for your unresolved symbols problem, you need to have correct paths set in Project->Properties->C/C++ General->Paths and Symbols/Includes tab, which depends on the compiler you choose to install.
这篇关于使得C ++在Eclipse中编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!