I am attempting to setup SDL2 for C++ with Eclipse on Windows 7.
In order to do so, I am following the tutorial in this link , which states that I must first install MinGW. So I follow the link provided in order to setup MinGW. I follow all the steps without issue. I then open Eclipse and attempt to build a simple hello world program:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}
To my surprise, this code doesn't build, with 6 errors.
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". I have also tried changing this to "C:\\mingw". Looking inside "C:\\mingw\\bin", I find gcc and g++:
In addition, compiling a test program using the command line (g++ Test.cpp -o Test) works just fine, as does "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. Questions I have looked at on SO (which haven't been able to fix my issue) include:
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 .
I have also reinstalled Eclipse to no avail.
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.
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++".
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.