QSsl Configuration in VS2013 strange error
-
Hi all,
I have Qt 4.8.6 custom build with Vs 2013. In my project every thing it works fine except the QSslConfiguration.
I have this in my header :#include <QSslConfiguration>
HTTPDataReader::HTTPDataReader(){
QSslConfiguration sslconfigure(QSslConfiguration::defaultConfiguration());// error line
}This line giving me errors with VS IDE (Qt 4.8.6 custom build with Vs 2013), but same file with Qt creator as IDE and same compiler(Qt 4.8.6 with Vs 2013) it works. Any idea to solve this. It seems , VS is missed some thing . Is there any way to check all my includes are working or not?
It showing the errors :
Error 1 error C2027: use of undefined type 'QSslConfiguration'
Error 2 error C3861: 'defaultConfiguration': identifier not found
Error 3 error C2079: 'sslconfigure' uses undefined class 'QSslConfiguration'
Error 4 error C2027: use of undefined type 'QSslConfiguration'
Error 5 error C3861: 'defaultConfiguration': identifier not found
Error 6 error C2079: 'sslconfigure' uses undefined class 'QSslConfiguration'
Error 7 error C2027: use of undefined type 'QSslConfiguration'
Error 8 error C3861: 'defaultConfiguration': identifier not foundthanks ,
Ni.Sumi -
@VRonin ,
you mean in the .pro ? If yes, I have added it and all other stuff like QNetworkAccessManager manager; QNetworkReply* reply are working fine. I have these errors only for the QSSlConfiguration and the QSslError .
But currently, I don't have pro file with my project, I have build the project using the Cmake.
-
Hi Mr. @kshegunov ,
Yes, I have checked the file and I can see that this line
//Path to a file.
QT_QTNETWORK_INCLUDE_DIR:PATH=C:/Qt/qt4.8.6_vs12/include/QtNetwork//The Qt QTNETWORK library
QT_QTNETWORK_LIBRARY:STRING=optimized;C:/Qt/qt4.8.6_vs12/lib/QtNetwork4.lib;debug;C:/Qt/qt4.8.6_vs12/lib/QtNetworkd4.lib//Path to a library.
QT_QTNETWORK_LIBRARY_DEBUG:FILEPATH=C:/Qt/qt4.8.6_vs12/lib/QtNetworkd4.lib//Path to a library.
QT_QTNETWORK_LIBRARY_RELEASE:FILEPATH=C:/Qt/qt4.8.6_vs12/lib/QtNetwork4.lib -
@Ni-Sumi
It is strange indeed. What about the compile lines from QtCreator and VS, you mentioned everything works fine with creator? Can you check the compile line for the offending file for each of the IDEs and post it here, there must be some flag that's missing ... or something of this sort ... -
@Ni.Sumi The .pro file seems to work fine here as the problem do not arise when calling qmake
Visual Studio IDE does not use the .pro file however, you should check that your VS project has $(QTDIR)\include\QtNetwork as part of the "Additional Include Directories" (if you are using Qt VS addin just check Qt Network checkbox in the qt configuration of the project -
Hi @VRonin ,
yes, Seems this is my problem. I have made a test project with checking and without Q Network at beginning of the project. Yes, the project with checked QNetwork did not go well.
But I have created the project using the CMake, which is different way of creating Qt projects in the VS IDE from Menu/QtAddin (Nothing likenew project , next naming source files, check Qt widgets, Networks, OpenL etc...).
Cold you please let me know , how can I do checking the QtNetwork this now in between the project ? ?? they must be way to do this. This is CMAKE file line which has all Qt link
target_link_libraries(${PROJECT_NAME} Qt4::QtCore Qt4::QtDeclarative Qt4::QtDesigner Qt4::QtDesignerComponents Qt4::QtGui Qt4::QtOpenGL Qt4::QtNetwork Qt4::QtTest Qt4::QtXml Qt4::QtXmlPatterns)
http://postimg.org/image/elqdpl6q9/ in VS linking
But its completely strange for me, all network related stuff like QNetwork, QNetworkReply worked fine, the problem started only when I started adding #include QSslConfiguration and QSslErrors.@kshegunov ,
Yes, In Qt creator it works fine with the same complier(Vs 2013 with qt 4.8.6). And this si the error line which is causing the probelm in my project.
QSslConfiguration sslconfigure(QSslConfiguration::defaultConfiguration());// error line
amd these are errors
error C2027: use of undefined type 'QSslConfiguration'
error C3861: 'defaultConfiguration': identifier not found
error C2079: 'sslconfigure' uses undefined class 'QSslConfiguration' -
@Ni.Sumi
I mean the compiler invocation, not the error (I saw the error in your first post). It should look something like this:g++ -c -pipe -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../myproject -I. -I../../../qt/qt-5.6/qtbase/include -I../../../qt/qt-5.6/qtbase/include/QtWidgets -I../../../qt/qt-5.6/qtbase/include/QtGui -I../../../qt/qt-5.6/qtbase/include/QtCore -I. -I../../../qt/qt-5.6/qtbase/mkspecs/linux-g++ -o somesource.o ../../myproject/somesource.cpp
/ I've taken it from g++, but you get the idea - the compile line, the call that compiles the offending source. /
Kind regards.