【问题标题】:Can't build project in Eclipse无法在 Eclipse 中构建项目
【发布时间】:2013-07-05 04:12:43
【问题描述】:

我正在使用 MinGW 在 Eclipse C++ OpenGL 中编程。

在我这样做之前,我的项目运行良好:-

Right-click on the the project and select "Properties"
Navigate to C/C++ Build -> Settings
Select the Tool Settings tab.
Navigate to GCC C++ Compiler -> Miscellaneous
In the option setting labeled Other Flags add -std=c++11

我这样做是因为我必须在我的代码中使用向量数组。

问题是现在我无法构建我的项目。当我单击构建时,它构建 100% 显示没有错误但不生成 .exe 文件。

编辑:= 解决方案。

-std=c++11 附加到命令行时放置一个空格。

【问题讨论】:

  • mingw-gcc 是什么版本的?删除-std=c++11 能解决问题吗?
  • @greatwolf 是的,删除 -std=c++11 并将我使用向量数组的行更改为简单的固定大小。矢量 cone1 { 0.0f, 2.4f, -11.0f, /*rotated*/30.0f, -1.5f, 0.0f, 0.0f }; to GLfloat cone1[] = { 0.0f, 2.4f, -11.0f, /*rotated*/30.0f, -1.5, 0.0, 0.0 };
  • 为什么不能在不添加标志的情况下使用向量?你包括 吗?
  • @GCC404 是的,我已经包括在内。但没有标志它说(这个)[sphotos-c.ak.fbcdn.net/hphotos-ak-ash4/…
  • 我认为在 C++98 中你不能将构造函数用于向量。要创建一个新向量,请执行以下操作:vector cone1;锥体1.push_back(0.0f); cone1.push_back(这里的元素);为什么它不编译 C++11,请尝试更新您的编译器。

标签: c++ eclipse opengl glut


【解决方案1】:

-std=c++11 附加到命令行时放置一个空格。

还有变化

 cone1 {1.0f , 2.0f};

cone1 = {1.0f, 2.0f}; //problem fixed after doing this.

注意:- 我这样声明我的向量

vector<GLfloat> cone1{1.0f, 3.0};

【讨论】:

    猜你喜欢
    • 2011-10-23
    • 2016-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多