Warning when initializing data members
Solved
General and Desktop
-
wrote on 1 Feb 2016, 04:20 last edited by
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). -
wrote on 1 Feb 2016, 14:46 last edited by
Thank you.
3/3