jeudi 12 octobre 2017

Eclipse CDT cannot resolve std:array, std::vector works fine

I am facing a lot of red crosses 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 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.

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).

Aucun commentaire:

Enregistrer un commentaire