Results 1 to 8 of 8

Thread: new QHttp() Error

  1. #1
    Join Date
    Feb 2007
    Posts
    71
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default new QHttp() Error

    #include <QApplication>
    #include <QHttp>
    #include <QUrl>
    #include <QFileInfo>
    #include <QFile>
    #include <QtDebug>

    class QHttp;

    int main(int argc,char *argv[])
    {
    QApplication qapp(argc,argv);
    QHttp *http;
    http=new QHttp(); // in there
    return qapp.exec();
    }

    output:


    1>------ Build started: Project: QTest, Configuration: Debug Win32 ------
    1>Performing Makefile project actions
    1>Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
    1>Copyright (C) Microsoft Corporation. All rights reserved.
    1> cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MDd -Zi -MDd -GR -EHsc -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"C:/Qt/4.2.2/include/QtCore" -I"C:/Qt/4.2.2/include/QtCore" -I"C:/Qt/4.2.2/include/QtGui" -I"C:/Qt/4.2.2/include/QtGui" -I"C:/Qt/4.2.2/include" -I"." -I"C:/Qt/4.2.2/include/ActiveQt" -I"debug" -I"." -I"c:\Qt\4.2.2\mkspecs\win32-msvc2005" -Fodebug\ @C:\DOCUME~1\Liu\LOCALS~1\Temp\nmF1.tmp
    1>main.cpp
    1> link /LIBPATH:"c:\Qt\4.2.2\lib" /NOLOGO /DEBUG /DEBUG /MANIFESTFILE:"debug\QTest.intermediate.manifest" /SUBSYSTEM:WINDOWS /OUT:debug\QTest.exe @C:\DOCUME~1\Liu\LOCALS~1\Temp\nmF2.tmp
    1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QHttp::QHttp(class QObject *)" (__imp_??0QHttp@@QAE@PAVQObject@@@Z) referenced in function _main
    1>main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall QHttp::metaObject(void)const " (?metaObject@QHttp@@UBEPBUQMetaObject@@XZ)
    1>main.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall QHttp::qt_metacast(char const *)" (?qt_metacast@QHttp@@UAEPAXPBD@Z)
    1>NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 8\VC\bin\link.EXE"' : return code '0x460'
    1>main.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall QHttp::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@QHttp@@UAEHW4Call@QMetaObject@@HPAPA X@Z)
    1>Stop.
    1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall QHttp::~QHttp(void)" (__imp_??1QHttp@@UAE@XZ) referenced in function "public: virtual void * __thiscall QHttp::`scalar deleting destructor'(unsigned int)" (??_GQHttp@@UAEPAXI@Z)
    1>debug\QTest.exe : fatal error LNK1120: 5 unresolved externals
    1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
    1>Build log was saved at "file://c:\Documents and Settings\Liu\My Documents\Visual Studio 2005\Projects\QTest\QTest\Debug\BuildLog.htm"
    1>QTest - 8 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



    ----------------------------------------
    why????

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: new QHttp() Error

    Why do you have a forward declaration of QHttp in there? You include QHttp anyway.
    What happens if you remove it?

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: new QHttp() Error

    Applications that use Qt's networking classes need to be configured to be built against the QtNetwork module. The following declaration in a qmake project file ensures that an application is compiled and linked appropriately:
    QT += network
    Edit:
    Quote Originally Posted by marcel View Post
    Why do you have a forward declaration of QHttp in there?
    Ahh, good spot!
    J-P Nurmi

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: new QHttp() Error

    Quote Originally Posted by jpn View Post
    Applications that use Qt's networking classes need to be configured to be built against the QtNetwork module. The following declaration in a qmake project file ensures that an application is compiled and linked appropriately:
    I am inclined to believe he is using Qt with Visual Studio because( maybe the commercial version of Qt ):
    1>------ Build started: Project: QTest, Configuration: Debug Win32 ------
    If I am correct, he has to add networking support from the project properties.
    If he is using VS integration, then it is easy. Otherwise he has to find the preprocessor definition, which I don't remember anymore .

    Regards

  5. #5
    Join Date
    Feb 2007
    Posts
    71
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: new QHttp() Error

    OK !! QT += network is good!

    forward declaration is my idea for this problem

    this is a low prlblem

  6. #6
    Join Date
    Feb 2007
    Posts
    71
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: new QHttp() Error

    thank you sir!

  7. #7
    Join Date
    Oct 2010
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Thumbs up Re: new QHttp() Error

    Great, it works now finally! I've been at this for about an hour.
    How come this is not done automatically by Qt Creator?

    Quote Originally Posted by jpn View Post
    Applications that use Qt's networking classes need to be configured to be built against the QtNetwork module. The following declaration in a qmake project file ensures that an application is compiled and linked appropriately.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: new QHttp() Error

    Quote Originally Posted by hadi2f View Post
    How come this is not done automatically by Qt Creator?
    And how should Creator know you are using some class from some library or module? You can name your own class QHttp too and it's not part of the QtNetwork module.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Installation on Fedora Core 4
    By jcr in forum Installation and Deployment
    Replies: 3
    Last Post: 29th January 2009, 01:34
  2. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  3. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 24th August 2006, 23:31
  4. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.