CodeLite installation/troubleshooting forum
borodadada
CodeLite Enthusiast
Posts: 22 Joined: Wed Oct 16, 2013 4:20 pm
Genuine User: Yes
IDE Question: c++
Contact:
Post
by borodadada » Sun Oct 20, 2013 6:37 pm
D:/c++/2/2/main.cpp:17:22: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
Code: Select all
class Class_windows_function
{
private:
int test_counter = 0;
public:
int counter_add(int number)
{
test_counter = test_counter+number;
return test_counter;
}
protected:
};
What's wrong? Why do I get? I can not locate a variable inside the method, since it must extend their.
eranif
CodeLite Plugin
Posts: 6375 Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:
Post
by eranif » Sun Oct 20, 2013 6:42 pm
This type of questions are not really related to codelite.
It is the _compiler_ that complains about it _not_ codelite
in short:
You can not initialize static members within the class declaration, unless you have enabled C++11 features (the warning gives you the exact flags to add to the compiler)
Eran
borodadada
CodeLite Enthusiast
Posts: 22 Joined: Wed Oct 16, 2013 4:20 pm
Genuine User: Yes
IDE Question: c++
Contact:
Post
by borodadada » Sun Oct 20, 2013 6:57 pm
-std=gnu++11
thank you Eran, work.