Eclipse C++: Symbol 'std' could not be resolved

前端 未结 10 1150
刺人心
刺人心 2020-12-08 03:01

I am getting this error in the TestExecute.cpp -

\"Symbol \'std\' could not be resolved\"

CODE

#include 

        
相关标签:
10条回答
  • 2020-12-08 03:03

    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

    • Activate CDT GCC Built-in Compiler Settings
    • Deactivate Use global provider shared between projects
    • Add the command line argument -std=c++11.

    0 讨论(0)
  • 2020-12-08 03:04

    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.

    0 讨论(0)
  • 2020-12-08 03:05

    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

    0 讨论(0)
  • 2020-12-08 03:11

    The problem you are reporting seems to me caused by the following:

    1. you are trying to compile C code and the source file has .cpp extension
    2. 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.

    0 讨论(0)
  • 2020-12-08 03:15

    You can rewrite the code likes this:

    #include<iostream>
    #include<stdio.h>
    
    using namespace std;
    
    0 讨论(0)
  • 2020-12-08 03:16

    For MinGW this worked for me:

    • Right click project, select Properties
    • Go to C/C++ General - Paths and Symbols - Includes - GNU C++ - Include directories
    • Select Add...
    • Select Variables...
    • Select MINGW_HOME and click OK
    • Click 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.

    0 讨论(0)
提交回复
热议问题