QMAKE_CXXFLAGS += -fpermissive -std=C++11 in .pro file generate compile error
-
Hi guys,
I'm running Qt 5.2 to create an application, within it I want to us c++11 features.
but when adding "QMAKE_CXXFLAGS += -fpermissive -std=C++11"
to my .pro file and compile I receive errors that the -std=C++11 part is not recogniced
":-1: error: error: unrecognized command line option '-std=C++11'"any suggestions??
-
.pro as it looks
QMAKE_CFLAGS = -fpermissive
QMAKE_CXXFLAGS += -fpermissive
-std=C++11
QMAKE_LFLAGS = -fpermissive -
Hi,
use
@CONFIG += c++11@
The correct flags will be added for you.Beware when you do something like
@
QMAKE_CFLAGS = -fpermissive
@
You are clearing the content of QMAKE_CFLAGS -
Hi SGaist,
thks for reply, tried CONFIG += c++11.
looks like it works however now generating huge amount of errors from the old C-code created prior to 1994 and included as nested includes.
Errors like :
error: 'boolean' does not name a typeShall try "extern "C" { } around the include's
Thanks for the warning on QMAKE_CFLAGS, look it up ;)
-
It's valid for any variable, right now it seems that you wiped CONFIG or is it a typo ?
-
Hi, fixed the problem caused by unnecessary included .h file. found and removed it. mission accomplished.
How do you mean wiped CONFIG?
@CONFIG = C++11@
or
@CONFIG += C++11 @They would set or add to CONFIG, as I understand it.
Do you mean at the ... = -fpermissive parts?I'm trying to read the QMake && Qt -manuals and understand config but don't see (unless I might be blind ) any suggestion there about this/why usage.
I had problem with vtable error and found the -fpermissive solution on the web, don't know why but it works ;) hence no worries and keep on coding.
[edit: added missing coding tags @ SGaist]
-
The vtable error generally arises when you add/remove the Q_OBJECT macro and don't run qmake before building
Most Qt defined variable you'll modify using either += or *= unless you have good reasons to empty its value first.