Hello World项目不会编译 [英] Hello World project will not compile

查看:361
本文介绍了Hello World项目不会编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始使用Eclipse CDT开发C ++应用程序。
我下载了Eclpse Kepler CDT软件包并正确打开,但是当我创建一个简单的hello world应用程序时,即使在构建项目后,我也得到了一个错误Binary Not Found。

I recently started using Eclipse CDT for developing C++ applications. I downloaded the Eclpse Kepler CDT bundle, and it opened up properly, but when i created a simple hello world application I was getting an error"Binary Not Found", even after building the project.

无法显示我的控制台显示

Ill show you what my console display

19:54:11 **** Incremental Build of configuration Debug for project HelloWorld ****
make all 
Building file: ../src/HelloWorld.cpp
Invoking: GCC C++ Compiler

g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/HelloWorld.d"-MT"src/HelloWorld.d" -o "src/HelloWorld.o" "../src/HelloWorld.cpp"

cc1plus: error: to generate dependencies you must specify either -M or -MM
make: *** [src/HelloWorld.o] Error 1

19:54:11 Build Finished (took 106ms)

我试过运行程序有两个工具链跨GCC和Linux GCC。

I tried running the program with 2 toolchains Cross GCC and Linux GCC.

有人可以告诉我发生了什么问题吗?

Could someone please tell me whats going wrong?

推荐答案

用一堆不同的编译器测试,OP中给出的命令似乎工作正常。这似乎是一个现实世界不同于应该的情况。

Tested with a bunch of different compilers, the command as given in the OP appears to work just fine. This seems to be a case of the real world being different from what should be.

解决方案是做编译器告诉我们do,即添加 -M -MM 标志。

The solution is to do what the compiler tells us to do, which is to add the -M or -MM flag.

为此,转到项目 - >属性 - > C / C ++构建 - >设置 - >工具设置 - >编译器 - >其他并添加 M -MM 其他标志

To do that, head to Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> Compiler -> Miscellaneous and add -M or -MM to Other flags.

下图说明了这一点:

另一方面, -MF 标志和 -MT 标志,但这似乎不是问题的原因。

As a side note, there is a missing space between the -MF flag and the -MT flag, but this does not appear to be the cause of the problem.

这篇关于Hello World项目不会编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆