The problem you are reporting seems to me caused by the following:
- you are trying to compile C code and the source file has .cpp extension
- you are trying to compile C++ code and the source file has .c extension
In such situation Eclipse cannot recognize the proper compiler to use.
Try restart Eclipse first, in my case I change different Compiler setting of the project then it shows this message, after restart it works.
I was having this problem using Eclipse Neon on Kubuntu with a 16.04 kernel, I had to change my
#include <stdlib.h> to
#include <cstdlib> this made the std namespace "visible" to Eclipse and removed the error.
This worked for me on Eclipse IDE for C/C++ Developers Version: 2020-03 (4.15.0) Build id: 20200313-1211. Also, my code is cross-compiled.
- Create a new project making sure it's created as a cross-compiled solution. You have to add the /usr/bin directory that matches your cross-compiler location.
- Add the C and C++ headers for the cross-compiler in the Project Properties.
- For C: Project > Properties > C/C++ General > Paths and Symbols > Includes > GNU C. Add... -> The path to your /usr/include directory from your cross-compiler.
- For C++: Project > Properties > C/C++ General > Paths and Symbols > Includes > GNU C++. Add... -> The path to your /usr/include/c++/ directory from your cross-compiler.
If you don't know your gcc version, type this in a console (make sure it's your cross gcc binary):
Modify the dialect for the cross-compilers (this was the trick).
- For C: Project > Properties > C/C++ Build > Settings > Tool Settings > Cross GCC Compiler > Dialect. Set to ISO C99 (-std=C99) or whatever fits your C files standard.
- For C++: Project > Properties > C/C++ Build > Settings > Tool Settings > Cross G++ Compiler > Dialect. Set to ISO C++14 (-std=c++14) or whatever fits your C++ files standard.
- If needed, re-index all your project by right-clicking the project > Index > Rebuild.
Install C++ SDK:
Help > Install New Software > Work with:
path for your eclipse version > search for C++ and install C++ sdk development tools.
Example for a path:
Mars - http://download.eclipse.org/releases/mars
What allowed me to fix the problem was going to: Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros, etc. -> Providers -> CDT GCC built-in compiler settings, enabling that and disabling the CDT Cross GCC Built-in Compiler Settings
The includes folder in the project is probably missing /usr/include/c++. Goto your project in project explorer, right click -> Properties -> C\C++ Build -> Environment -> add -> value= /usr/include/c++. Restart eclipse.
You can rewrite the code likes this:
#include<iostream> #include<stdio.h> using namespace std;
For MinGW this worked for me:
- Right click project, select
- Go to
Paths and Symbols-
You should now see several MinGW paths in Includes in your project explorer.
The errors may not disappear instantly, you may need to refresh/build your project.
If you are using Cygwin, there could be an equivalent variable present.
I do not know whether you have solved this problem but I want to post my solution for those might ran into the same problem.
First, make sure that you have the "Includes" folder in your Project Explorer. If you do not have it, go to second step. If you have it, go to third step.
Second, Window -> Preferences-> C/C++- > Build >Environment: Create two environment variables:
Cygwin/usr/include/, if you cannot find folder "c++", copy it from
\cygwin\lib\gcc\i686-pc-cygwin\X.X.X\include and Then restart your Eclipse.
- Third, Right Click your project in Project Explorer -> Properties -> C/C++ General -> Paths and Symbols -> Includes -> Languages:GNU C++ If you can find some C++ folders in the "Include directories" then click Apply and OK. Change a bit your codes, and save it.
You will find there will be not symbol could not be resolved problems.
I documented my solution, hoping someone might get benefits.
Try out this step: https://www.eclipse.org/forums/index.php/t/636348/
Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros, etc. -> Providers
- Activate CDT GCC Built-in Compiler Settings
- Deactivate Use global provider shared between projects
- Add the command line argument -std=c++11.
- Eclipse CDT: Symbol 'cout' could not be resolved
- Eclipse C++: Symbol 'std' could not be resolved
- Eclipse Mars: Symbol 'unique_ptr' could not be resolved
- Symbol 'cv' could not be resolved in eclipse
- Eclipse symbol could not be resolved
- on centos eclipse symbol 'yyy' could not be resolved multiple errors coming
- Symbol could not be resolved eclipse CDT
- Cuda eclipse and time.h, Symbol 'CLOCK_PROCESS_CPUTIME_ID' could not be resolved although program runs
- Eclipse CDT - Symbol `__RLIMIT_NPROC` could not be resolved
- How to solve eclipse cross-compilation c/c++ error. Symbol could not be resolved issue
- Symbol 'cout' could not be resolved and #include expects "FILENAME" errors with simple math program in eclipse
- Eclipse c++ Type could not be resolved error even though build is successful
- Eclipse Indigo CDT: Function could not be resolved
- error , Symbol 'vector' could not be resolved
- Eclipse Method could not be resolved in a simple program C++
- Android NDK in Eclipse Type size_t could not be resolved
- Cocos2D-X for android, Symbol 'cocos2d' could not be resolved
- getopt_long could not be resolved in Eclipse CDT
- Eclipse method could not be resolved for vector of vectors
- Eclipse C/C function 'printf' could not be resolved
- Eclipse complains method c_str could not be resolved
- Eclipse CDT: Type std::string could not be resolved
- Symbol 'A' could not be resolved
- C++ error Type 'std::thread' could not be resolved Eclipse Mars 4.5 , Ubuntu 12.04
- Eclipse: Symbol 'cout' could not be resolved on Ubuntu 64Bit
- eclipse c++ function defined in header could not be resolved
- Importing a makefile inside Eclipse - symbols could not be resolved
- in play framework, the file xx.java could not be compiled. error raised is : the import yyy cannot be resolved in eclipse
- Symbol "hash" could not be resolved
- mex functions could not be resolved eclipse
More Query from same tag
- Eclipse IDL compilation
- Scanner Stops Working and Println Problems, Why?
- Is it an eclipse or maven-compiler-plugin bug, the generics Class cast issue?
- A JavaFX GUI is working perfectly fine with Netbeans IDE, but not with eclipse
- Is it possible to change the order of static imports followed by imports in eclipse?
- eclipse check in by line when using perforce (like how intelliJ does it)
- IDE Breakpoints for GWT 2.5 SourceMaps in Chrome?
- Java being installed in 2 different directories on MacOS
- Why am I getting a runtime error eventhough it runs perfectly on eclipse
- compile successfully in console but errors occur after importing into eclipse
- xtext ide not loading library
- Creating jar files using Eclipse
- How to read multiple integers from single line java
- syso shortcut doesn't work in some part of code
- Create Eclipse Project from Android Git
- Running Visual VM from eclipse
- Error! The first argument to the non-static Java function 'replace' is not a valid object reference
- How to install eclipse PDT 3.1 in Eclipse Juno?
- Do I need to install Java plugins for Eclipse Neon if I already have JDK and JRE installed?
- Debug Maven plugin under Eclipse
- GGTS: gsp editor is not working
- Egit plugin configuration for pushing the existing project
- No module named PIL error in eclipse
- Not able to hide the Android title bar outside the onCreate method
- Eclipse: show problem where the (keyboard) cursor is?
- NullPointerException adding data to BST
- Eclipse WindowBuilder / Jframe - Update labels text
- getChildcount for specific Image
- Eclipse hangs when trying to debug clojure project
- Proper way to add ojdbc8.jar to Eclipse/maven project