[SOLVED] QT 4.8.3 Mac OS X (Mountain Lion) QHttp/QNetworkAccessManager



  • Hi,

    I've just installed Qt 4.8.3 on my Mac and I have small problem with including QHttp or QNetworkAccessManager.
    I can see QNetworkAccessManager in /Library/Frameworks/ but when I am trying do add it in header file IDE is giving me error :/

    Can anyone tell me how to install corectly QT on Mac?
    Previously installer was installing IDE in a specific folder and everything was working fine, but now I am little confuesd, especialy that I am not keen on in Qt (not yet ;) ).

    Maciej.


  • Moderators

    What is the error that the IDE is giving you?



  • #include <QHttp>
    .../myjson.h:5: błąd:QHttp: No such file or directory

    #include <QNetworkAccessManager>
    .../myjson.h:5: błąd:QNetworkAccessManager: No such file or directory

    but file is located in:
    /Library/Frameworks/QtNetwork.framework/Versions/4/Headers/qnetworkaccessmanager.h



  • I found that if I do in that way:

    @
    #ifndef MYJSON_H
    #define MYJSON_H

    #include <QObject>
    //#include "QNetworkAccessManager"

    #include "/Library/Frameworks/QtNetwork.framework/Versions/4/Headers/qhttp.h"

    class myJson
    {
    public:
    myJson();

    public slots:
    int getJsonFromUrl(QString aJsonURL);

    };

    #endif // MYJSON_H
    @

    then project is going to compile, but I don't think that is the correct solution :(



  • Does anyone has any idea?
    I've installed Qt from pkg installer in order:

    1. qt-mac-opensource-4.8.3-debug-libs.dmg
    2. qt-mac-opensource-4.8.3.dmg
    3. qt-creator-mac-opensource-2.5.2.dmg

    maybe this generates my problems??



  • Ok - I got it ;-)

    I've just installed qt 1.2.1 and there in QTCreater intelli sense hints this:
    @
    #include <QtNetwork/QHttp>
    #include <QtNetwork/QNetworkAccessManager>
    @

    and this is it ;-)

    For me topic is solved ;)


  • Moderators

    Glad you were able to figure it out! Apparently nobody had anything helpful to offer. I was at a loss, so I didn't comment. Hopefully your solution will help anyone else with a similar problem. Thanks for posting it.

    Be sure and edit your initial post to add [Solved] to the title.



  • I know that topic is solved but I've found better and more correct way to solve the case ;-)

    In file *.pro we need to add line:
    @QT += network@

    and then in our module/header file we can use:

    @ #include <QNetworkAccessManager>
    #include <QUrl>@

    In this way compilation is correct and we are not given strange errors ;-)


  • Moderators

    Oh yes... that's obviously the cause. So simple it never occurred to me that you might not have done that. Sorry about that.



  • It's ok ;-) I'am newbie and I didn't do the most basic thing: RTFM ;)
    I looked in example with http and the solution was so clear ad easy to find.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.