I am facing a lot of saying
Symbol 'array' could not be resolved
, with code that is building fine.
#include <math.h>
#include <array>
#include <sstream>
#include <string>
static std::string printArray(std::array<double, 3> data) {
std::ostringstream strs;
strs << "( " << data[0] << " " << data[1] << " " << data[2] << " )";
return strs.str();
}
static std::string printVector(std::vector<double> data) {
std::ostringstream strs;
strs << "( " ;
for (const auto & value : data )
strs << value << " ";
strs << " )";
return strs.str();
}
The c++11 feature are activated using the -std=c++11
flag under C/C++ General -> Preposcessor Include Path, Macros etc. -> Porvides -> CDT GCC Built-in Compiler Settings
as described here or here.
My question is no duplicate, since it works for std::vector
and other c++11 features are handled correctly.
The header (#include <array>
) can be resolved by pressing F3.
I am using Eclipse the CDT Version: Neon.3 Release (4.6.3).
I had the exact same symptoms that the OP reported:
#include <array>
and F3 successfully navigates to the array header file.I tried the solution provided by schorsch312, and it worked except the steps presented are not exactly consistent with my Neon version of Eclipse (same version used by OP). Hence, I had to adjust the instructions slightly. Here is what worked for me:
Select Project -> C/C+ Index -> Rebuild -- if that operation did not automatically trigger.
Now, eclipse can resolve references to array properly. Note that this solution assumes you have previously resolved the general issue of getting c++11 syntax working.