5

I have this line written in my code

vector<GLfloat> cone1 { 0.0f, 2.4f, -11.0f, /*rotated*/30.0f, -1.5f, 0.0f, 0.0f };

But the errors comes up like in C++98, variable must be initialized by constructor not by {}

I have searched the solution that I should use -std-c++11, but I don't know how to add this in Eclipse?

Umair Ayub
  • 19,358
  • 14
  • 72
  • 146

1 Answers1

11

You can do this in a few simple steps...

  • Right-click on the the project and select "Properties"
  • Navigate to C/C++ Build -> Settings
  • Select the Tool Settings tab.
  • Navigate to GCC C++ Compiler -> Miscellaneous
  • In the option setting labeled Other Flags add -std=c++11

Now rebuild your project.

Note: this assumes you did not create your project to use GNU Autotools or a makefile.

Captain Obvlious
  • 19,754
  • 5
  • 44
  • 74