1

I get these two errors, when trying to initialize a vector with

std::vector im = {i,j,k};

Errors:

  • could not convert ‘{i, j, k}’ from ‘’ to ‘std::vector’

  • C++98 ‘im’ must be initialized by constructor, not by ‘{...}’

I think the problem is, that Eclipse is not using the C++11 libraries. I have tried to get Eclipse to use them as suggested on here (Eclipse CDT C++11/C++0x support), but it still does not work.

I am running Ubuntu 15.10 with the g++ version 5.2.1 20151010.

Thanks :)!

EDIT: I am just a bit clumsy, added the flag in the wrong tab... Working now!

Community
  • 1
  • 1
Linda
  • 1,003
  • 1
  • 11
  • 25
  • Have you added the `-std=c++11` compiler flag as described? That should be all you need for a modern GCC. – melak47 Mar 07 '16 at 15:25
  • I have checked again, it seems I added it in a wrong way... But it is working now! Thanks :)! – Linda Mar 07 '16 at 15:32

1 Answers1

1

You can update the compiler flags as suggested, but Eclipse C++ support has evolved very much from version to 3.8 to version 4.5, the current stable one. So by updating Eclipse you will also get better code hinting and completion in the editor and even support for the latest C++14 features.

  • Thanks, will do! I haveinstalled it via Synaptic and did not realize that more updates were not supported... – Linda Mar 07 '16 at 18:17