I am using eclipse in linux to develop a c++ application and I am getting this editor annotation error \"Symbol \'vector\' could not be resolved\" from the following code
Apparently vector belongs to C++ standard template library from MinGW perspective. so in addition to
#include <vector>
Add
using namespace std;
after the header file inclusions.
See Also related question: Eclipse CDT: Symbol 'cout' could not be resolved
for me the problem was that in #include <vector>
somewhere there is #include <bits/c++config>
which has a different include path than #include <vector>
i.e.: /usr/include/c++/4.6/x86_64-linux-gnu
I know that this problem was already solved, but it still appears as the top result on Google.
Using Eclipse Neon for Linux I solved it with Quick Fix
:
Created a *.cpp
file that includes the *.h
where the error is showing. This will force Eclipse to backtrace dependencies for *.h
.
Is working for me...
#include<vector>
should be included at top.
Most likely you have some system-specific include directories missing in your settings which makes it impossible for indexer to correctly parse iostream, thus the errors. Selecting Index -> Search
For Unresolved Includes in the context menu of the project will give you the list of unresolved includes which you can search in /usr/include
and add containing directories to C++ Include Paths and Symbols in Project Properties.
On my system I had to add /usr/include/c++/4.6/x86_64-linux-gnu
for bits/c++config.h
to be resolved and a few more directories.
Don't forget to rebuild the index (Index -> Rebuild) after adding include directories.