eclipse 4.2 cdt with ubuntu 12.04 configuration
eclipse 4.2 cdt with ubuntu 12.04 configuration
我在Ubuntu 12.04上运行Eclipse CDT(Eclipse v.4.2)。当我创建一个C++项目(在项目类型->可执行文件->Hello World C++项目下)并选择Linux GCC工具链时,标准的Hello World应用程序编译并运行得很好。当我尝试创建一个空项目(从与以前相同的菜单中),同时选择Linux GCC工具链时,它会带来几个构建错误:
make:***[tst] Error 1
Symbol 'cout' could not be resolved
Symbol 'endl' could not be resolved
Symbol 'std' could not be resolved
undefined reference to 'main'
当我比较"Hello World C++Project"生成的.cpp文件和添加到"Empty Project"的.cpp的路径设置(Properties->C/C++Build和C/C++General)时,它们具有相同的配置和设置,所以我不确定为什么空项目没有检测到标准库并进行编译。includes文件夹中的所有文件也是相同的。这也发生在我的Windows7(MingW编译器)安装和MacOSX安装上。目前,我可以将我的项目创建为"Hello World C++项目",去掉我想要的文本和代码,但我真的很好奇如何从头开始设置它,特别是因为我的理解是,在可执行文件夹下创建"空项目"(而不是创建Makefile项目)应该包括一个Makefile和所有必要的路径(只要选择了正确的工具链?)。
CDT控制台的实际构建错误为:
20:49:26 **** Incremental Build of configuration Debug for project tst ****
make all
Building target: tst
Invoking: GCC C++ Linker
g++ -o "tst" ./src/test.o
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [tst] Error 1
20:49:26 Build Finished (took 62ms)
我尝试运行的代码只是eclipse生成的默认helloworld代码:
#include <iostream>
using namespace std;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
return 0;
}
提前谢谢。
我看到一些在杂志上出售的Ubuntu 12.04 DVD默认不安装gnu G++。转到Ubuntu软件中心并安装G++(GNU C++编译器工具链)。安装完成后,在IDE左侧的Eclipse项目浏览器中右键单击项目名称。选择"索引"项下的"重建"。这应该可以解决iostream-include等的问题。
- 在Ubuntu 16.04上安装Cilk时出现问题
- 如何在Ubuntu中使用cmake设置qt4
- 链接阶段在Ubuntu上失败,但在MacOS上失败
- 如何在OpenSSL中从configuration.h.in获取configuration.h
- 无法将 GLFW 库与 Ubuntu 18.04 上的头文件链接
- 无法在Ubuntu上将共享库与Eclipse链接
- 树莓上的 Libtorch 无法加载 pt 文件,但在 ubuntu 上工作
- 无法安装 R 包 "nloptr"(Ubuntu 16.04 上的 R3.6.2) - C++编译器问题
- 使用 ubuntu 终端在 c++ 上运行线程类的问题
- 如何在 Ubuntu 上安装 OpenCV for C/C++
- 估计 Ubuntu C++内存使用情况
- 在 Ubuntu 中创建自动安装程序
- 分段 Linux Ubuntu 中的 g++ 错误,但在 Windows 中的 g++/MingW 中,在 C++ 中打
- OpenGL 在 VMWare Fusion 版本 10.1.3 上安装的虚拟机 (Ubuntu 16.04) 上崩溃
- 在 ubuntu 上安装 node js pulsar 客户端
- 在 Ubuntu 18.04 上编译 GLSL 着色器时"不支持 GLSL 3.30"?
- 这是 ubuntu 16.04 中的 gdb 错误吗?
- 生成文件:6:目标'all'的配方在 Ubuntu-16.04 上失败
- LinuxdeployQT 今天如何创建 Appimage,自 ubuntu 16.04 发布以来,它可以在每个 Lin
- eclipse 4.2 cdt with ubuntu 12.04 configuration