I am getting this error in the TestExecute.cpp -
"Symbol 'std' could not be resolved"
CODE
#include <iostream>
using namespace std;
I just created a executable project in Eclipse (in Windows 7) as shown below. It seems like I am selecting a toolchain that is not supported. Is it so? I have installed Cygwin and it is available in preferences.
EDIT: Based on @RobertoWilko comment, removing the line "using namespace std; " removed the error. But the binary is not created. "Launch Failed. Binary not found". How to correct this?
This question is related to
c++
eclipse
eclipse-cdt
For MinGW this worked for me:
Properties
C/C++ General
- Paths and Symbols
- Includes
- GNU C++
- Include directories
Add...
Variables...
MINGW_HOME
and click OK
Apply
and OK
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.
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.
If you don't know your gcc version, type this in a console (make sure it's your cross gcc binary):
gcc -v
Modify the dialect for the cross-compilers (this was the trick).
Try out this step: https://www.eclipse.org/forums/index.php/t/636348/
Go to
Project -> Properties -> C/C++ General -> Preprocessor Include Paths, Macros, etc. -> Providers
Try restart Eclipse first, in my case I change different Compiler setting of the project then it shows this message, after restart it works.
You can rewrite the code likes this:
#include<iostream>
#include<stdio.h>
using namespace std;
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.
The problem you are reporting seems to me caused by the following:
In such situation Eclipse cannot recognize the proper compiler to use.
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
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:
a) Name: C_INCLUDE_PATH
Value: /usr/include
b) Name: CPLUS_INCLUDE_PATH
Value: /usr/include/c++
Go to 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.
You will find there will be not symbol could not be resolved problems.
I documented my solution, hoping someone might get benefits.
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
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.
Source: Stackoverflow.com