[英]Eclipse g++ not found in path: windows
I am attempting to setup SDL2 for C++ with Eclipse on Windows 7. 我试图在Windows 7上使用Eclipse为C ++设置SDL2。
In order to do so, I am following the tutorial in this link , which states that I must first install MinGW. 为了做到这一点,我正在按照此链接中的教程进行操作, 该链接指出我必须首先安装MinGW。 So I follow the link provided in order to setup MinGW.
所以我按照提供的链接来设置MinGW。 I follow all the steps without issue.
我毫无问题地遵循所有步骤。 I then open Eclipse and attempt to build a simple hello world program:
然后我打开Eclipse并尝试构建一个简单的hello world程序:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}
To my surprise, this code doesn't build, with 6 errors. 令我惊讶的是,这个代码没有构建,有6个错误。
I then proceed to simplify the program further: 然后我继续进一步简化程序:
int main()
{
return 0;
}
This also does not compile. 这也不编译。 There are two errors:
有两个错误:
However, my path does contain "C:\\mingw\\bin". 但是,我的路径确实包含“C:\\ mingw \\ bin”。 I have also tried changing this to "C:\\mingw".
我也尝试将其更改为“C:\\ mingw”。 Looking inside "C:\\mingw\\bin", I find gcc and g++:
在里面看“C:\\ mingw \\ bin”,我找到了gcc和g ++:
In addition, compiling a test program using the command line (g++ Test.cpp -o Test) works just fine, as does "g++ -v". 此外,使用命令行(g ++ Test.cpp -o Test)编译测试程序的工作正常,“g ++ -v”也是如此。
I have been searching the web for hours, and can't seem to find an answer as to why Eclipse can't seem to compile anything with MinGW. 我一直在网上搜索几个小时,似乎无法找到答案为什么Eclipse似乎无法用MinGW编译任何东西。 Questions I have looked at on SO (which haven't been able to fix my issue) include:
我在SO上看到的问题(无法解决我的问题)包括:
Additional info: Window > Preferences > C/C++ > Build > Settings > "CDT GCC Built-in Complier Settings MinGW [Shared]" : Toolchain MinGW GCC is not detected on this system . 附加信息:窗口>首选项> C / C ++>构建>设置>“CDT GCC内置编译器设置MinGW [共享]”: 在此系统上未检测到工具链MinGW GCC 。
I have also reinstalled Eclipse to no avail. 我也重新安装了Eclipse无济于事。
I realize that this may be a duplicate question of some that I have linked, but the information in previous questions have not been able to fix my problem, and I fear that adding a comment to an old question may not result in an answer. 我意识到这可能是我所链接的一些重复问题,但之前问题中的信息无法解决我的问题,我担心在旧问题上添加评论可能不会得到答案。
Please request additional information as needed. 请根据需要提供更多信息。
You need to set the environment for the c/c++ builder. 您需要为c / c ++构建器设置环境。
Hope that helps. 希望有所帮助。
It appears as though I have fixed the problem for the moment. 好像我现在已经解决了这个问题。
In case others encounter the same issue: Project > Properties > C/C++ Build > Settings > MinGW C++ Linker > Command changed from "g++" to "C:\\mingw\\bin\\g++". 如果其他人遇到相同的问题:项目>属性> C / C ++生成>设置> MinGW C ++链接器>命令从“g ++”更改为“C:\\ mingw \\ bin \\ g ++”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.