I'm trying to set up a C/C++ development environment on Eclipse.
I installed the following Eclipse plugins:
Then download MinGW.
I followed this for set up: Set up Eclipse C++ compiler without auto-install or altering System Path on Windows then:
Menu *Project* ? *Properties* ? *"C/C++ Include Paths and Symbols"* ? *"Add External Include path...". I added these paths:
C:\MinGW\lib\gcc\mingw32\4.4.0\include
C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++
C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++\backward
C:\MinGW\lib\gcc\mingw32\4.4.0\include\c++\mingw32
C:\MinGW\lib\gcc\mingw32\4.4.0\include-fixed
It still gives me a "Function 'printf' could not be resolved" error or any other function for that matter.
Here is the code
#include <stdio.h>
int main() {
printf("Hello, World!!!!");
return 0;
}
When I do Ctrl + Space, Eclipse gives me suggestions for C++ functions, but it gives the same error when I select them. It's probably a simple settings change. It would be really helpful if you could help me figure this out.
You must include <stdio.h> above your main(). This should solve it:
#include <stdio.h>
int main() {
printf("Hello World!!!");
return 0;
}
Sometimes, Eclipse's parser gets stupid. You can try reparsing the project. Right click on your project then → Index → Rebuild. After rebuild, most likely the symbols will be recognized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With