Warning when initializing data members
Solved
General and Desktop
-
Hi,
When I initialize data members such asQLineEdit *LineEdit_Name = new QLineEdit;
I get the following warning:
warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11
QLineEdit *LineEdit_Name = new QLineEdit;Any idea why?
Thank you.
^ -
Are you trying to do it directly in the class like:
class MyClass { private: QLineEdit *LineEdit_Name = new QLineEdit; }
Do the initialisation in the constructor of your class.
Or activate C++11 support like the error message suggests (add CONFIG += c++11 to the PRO file).