I have started a program and when I tried to compile ant it throws this warning:

warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]

I'm using gcc 4.7 in debian Wheezy programming in c++.

Thanks for reading it ^^

Recommended Answers

All 3 Replies

Hard to say for sure without seeing the code itself, but it looks to me that you're trying to initialize a member of your class in the declaration of the member.

Define static data members outside the class if you are not using c++11 like this: <datatype> <classname>::<varname> = value <> indicate placeholders.

You'll need to provide more information then that. A small code example reproducing the error would be ideal.

I'm gonna take a shot in the dark though. Try setting that value in the classes initializer instead.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.