Add -fpermissive at the compiler
-
Hello i have this error:
error: cannot call constructor ‘QHostAddress::QHostAddress’ directly [-fpermissive]
How i can solve?Thanks Luca
-
Would you enlighten us with some code, please? :-)
-
@
QString ip:
QHostAddress ip_test;
ip_test = QHostAddress::QHostAddress(ip.toLongLong());@
error: cannot call constructor ‘QHostAddress::QHostAddress’ directly [-fpermissive]Thanks Luca
-
No solution please?
-
This is not a compiler bug/problem, but, sorry to say that, a lack of C++ skills and I can see why nobody is responding. Please look at http://www.cplusplus.com/doc/tutorial/classes/ to see how constructor declaration, implementation and usage differ in Syntax.
Given a QString ip, what's wrong about
@
QHostAddress ip_test(ip)?
@ -
[quote author="luca72" date="1323253935"]No solution please?[/quote]
Nagging after 3 hours? You're not serious! Please read and understand: http://www.catb.org/~esr/faqs/smart-questions.html
If considered ok at all then pushing a topic is acceptable after waiting a few days, not after 3 hours.
Danimo already gave you the answer, what's wrong with your syntax.
-
I know is you ask long time ago, but try add to project *.pro file:
QMAKE_CFLAGS += -std=c++11 -fpermissive
QMAKE_CXXFLAGS += -std=c++11 -fpermissive
QMAKE_LFLAGS += -std=c++11 -fpermissive
I use it for Mac and GCC4.8.1 -
ydk2, are you sure it is as you write
QMAKE_CFLAGS = -std=c+11 -fpermissive
QMAKE_CXXFLAGS = -std=c+11 -fpermissive
QMAKE_LFLAGS = -std=c+11 -fpermissiveBecause I get a complaint from the compiler "unrecognized command line option '-std=c+11'"
-
Sorry I use gcc-4.8.1 on Mac with C11 support, but simple erase -std=c+11 and leave only
QMAKE_CFLAGS = -fpermissive
QMAKE_CXXFLAGS = -fpermissive
QMAKE_LFLAGS = -fpermissive -
This post is deleted!