Warning: initializers for non-static data entry elements are only available with -std = C ++ 11 or -std = gnu ++ 11 [enabled by default]

I just installed the latest version of cygwin and eclipse luna on my machine. It works great and I can run my projects. However, when I create them, I get warnings that I don’t understand. For example, here are the warnings from the header file "Sales_item.h" that I received from the C ++ Primer book site:

warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default]
     Sales_item() = default;
                    ^
../src/Sales_item.h:70:27: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
     unsigned units_sold = 0; // explicitly initialized
                           ^
../src/Sales_item.h:71:22: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
     double revenue = 0.0;
                      ^
Finished building: ..

What do these warnings mean? Do I have to do something?

+4
source share
1 answer

-std=c++0x, -std=c++11 -std=c++1y .

, :

defaulted and deleted functions only available with -std=c++11 or -std=gnu++11

:

g++ -std=c++0x main.cpp -o myExe

Eclipse, πάντα ῥε, :

Project ->Properties ->C++ Build ->Misc Options

, Kepler Eclipse, , :

Properties ->C++ Build -> Settings

Command . .

. , Baum mit Augen.

+4

Source: https://habr.com/ru/post/1546427/


All Articles