8

Using Eclipse Mars, I am getting the Symbol 'unique_ptr' could not be resolved error. I tried adding -std=c++11 to CDT GCC Built-in Compiler Settings, but this didn't help. The error goes away when I reopen Eclipse, but if I make a modification to the code, the error comes back.

One simple code sample:

std::unique_ptr<String> p1;
freedomn-m
  • 27,664
  • 8
  • 35
  • 57

1 Answers1

15
  1. In Eclipse Mars open Window > Preferences > C/C++ > Build > Settings > Discovery > CDT GCC Build-in Compiler Settings
  2. Append -std=c++11 to the Command to get compiler specs
  3. Press OK
  4. Rebuild the index: Project > C/C++ Index > Rebuild
Matthias
  • 7,432
  • 6
  • 55
  • 88
  • 2
    For me it was necessary to 5. Restart Eclipse For whatever reason?! – IanH Aug 21 '16 at 08:53
  • And in my case I had to rebuild the index ( Right-Click on Project > Index > Rebuild ) in the end. – Omid Ariyan Jan 03 '17 at 11:18
  • Also, std::make_unique is only defined in C++14 and later compilers (https://stackoverflow.com/questions/24609271/errormake-unique-is-not-a-member-of-std). – jigglypuff Feb 26 '18 at 05:19