0

I have this code in a .h file in a project in Eclipse IDE.

#include <cstdlib>
#include <stdint.h>
#include <random> // this is its header

std::mt19937 rng(time(NULL)); // mersenne numbers
int random(int n) {
  std::uniform_int_distribution<int> distribution(0, n);
  return distribution(rng);
}

However, Eclipse says that it can't resolve that symbol. It can run the code though. The problem is that it leaves the file marked with a red x, indicating error, which makes it a bit ugly when debugging, since I have many files in my project.

How do get rid of this Eclipse weakness?

gsamaras
  • 71,951
  • 46
  • 188
  • 305
  • Please see [Eclipse and C++11](http://stackoverflow.com/questions/9131763/eclipse-cdt-c11-c0x-support) and [this](http://stackoverflow.com/questions/13635079/enable-c11-in-eclipse-cdt-juno-kepler-indexer) (unrelated : why `` ?) – quantdev Aug 13 '14 at 21:22
  • Worked as expected, thanks. Should I close my question or mark it as a duplicate? Or maybe you can answer it and I will accept it. The header you mentioned is there for something else in the same file. @quantdev – gsamaras Aug 13 '14 at 21:27

0 Answers0