Please Help me How to install QT on VC++ 2008



  • hello guys. I have download "qt-win-opensource-4.7.4-vs2008" and install it . now what i must do ?



  • my windows is windows 7 64 bit and my IDE is visual studio 2008 sp1
    tnx



  • You also need to download Qt Visual Studio Add-in.



  • "Here":/doc/gettingstarted.html is a good starting point.



  • yes tnx i download Qt Visual Studio Add-in but i cant Compile my code :( i create one Qt Application with Qt Add-in but take Error on compile time :( please help me i cant use Qt . please help me with Qt VS Add-in



  • my question exactly is "how to include qt headers and library to vs 2008"? if i install "qt-win-opensource-4.7.4-vs2008" and "Qt Visual Studio Add-in", its enough ?!! or i must compile or copy or set inlcude directory to vs ? sorry for my bad eng language



  • You need to set Qt installation directory. You should have Qt menu on VC menubar. Open it and choose Options and set Qt installation directory. Other solutions is to set QTDIR environment variable.



  • OK i open qt > qtoption . i have two tap one Qt versions that Add 4.7.4 c:\qt\4.7.4 and other tap is Qt Defualt setting :-?? what i must to do ?



  • c:\qt\4.7.4



  • yes this address is added to Qt Option > qt version



  • ... and you still are unable to build projects with Qt dependency ?
    If not, what are the errors ?



  • yes exactly . 1) i install qt-win 2) install qt vs add in 3) create qt application with qt addin 4)push F7(build solution)

    Errors:

    Warning 2 warning C4273: 'staticQtMetaObject' : inconsistent dll linkage c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\GeneratedFiles\Debug\moc_qt.cpp 41
    Error 7 fatal error C1903: unable to recover from previous error(s); stopping compilation c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\qt.cpp 4
    Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\qt.cpp 4
    Error 9 error C2882: 'Qt' : illegal use of namespace identifier in expression c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\main.cpp 7
    Error 1 error C2869: 'Qt' : has already been defined to be a namespace c:\users\ahura\documents\visual studio 2008\projects\qt\qt\qt.h 7
    Error 4 error C2869: 'Qt' : has already been defined to be a namespace c:\users\ahura\documents\visual studio 2008\projects\qt\qt\qt.h 7
    Error 8 error C2869: 'Qt' : has already been defined to be a namespace c:\users\ahura\documents\visual studio 2008\projects\qt\qt\qt.h 7
    Error 3 error C2491: 'QObject::staticQtMetaObject' : definition of dllimport static data member not allowed c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\GeneratedFiles\Debug\moc_qt.cpp 41
    Error 13 error C2228: left of '.show' must have class/struct/union c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\main.cpp 8
    Error 10 error C2146: syntax error : missing ';' before identifier 'w' c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\main.cpp 7
    Error 11 error C2065: 'w' : undeclared identifier c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\main.cpp 7
    Error 12 error C2065: 'w' : undeclared identifier c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\main.cpp 8
    Error 5 error C2039: 'Qt' : is not a member of 'Qt' c:\Users\AhUrA\Documents\Visual Studio 2008\Projects\Qt\Qt\qt.cpp 3



  • Try to rename your files. From what I see you have Qt.cpp and Qt.h in your project. And don't use only Qt in your namespaces or class definitions or other defined type.



  • this is a preCode and i dont type this. its come when i use Add-in



  • So, it's not a include Qt headers error, this means VC recognize your Qt installation. I suspect something wrong in your code. Can you post the code ?



  • @
    #ifndef QT_H
    #define QT_H

    #include <QtGui/QMainWindow>
    #include "ui_qt.h"

    class Qt : public QMainWindow
    {
    Q_OBJECT

    public:
    Qt(QWidget *parent = 0, Qt::WFlags flags = 0);
    ~Qt();

    private:
    Ui::QtClass ui;
    };

    #endif // QT_H
    @

    @#include "qt.h"

    Qt::Qt(QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags)
    {
    ui.setupUi(this);
    }

    Qt::~Qt()
    {

    }
    @

    @#include "qt.h"
    #include <QtGui/QApplication>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    Qt w;
    w.show();
    return a.exec();
    }
    @



  • some body please help me :(((((((((



  • First, please be more patiently. We all do the support here in our spare time and as volunteers. If your topic has that much answers, someone will surely come back with an answer.

    As others already have mentioned, do not name your class Qt! This will conflict with the Qt namespace in the Qt libs itself. Additionally, it's good practice to not prefix your own classes with Q or Qt, as this is informally reserved for Qt's own classes.



  • sorry :( my IDE is visual stduio 2008 pro sp1. can i compile with this ?
    i try to set Environment variable and download "qt-everywhere-opensource-src-4.7.4" then configure and run nmake but return error code 02



  • Yes, this works.
    You can use the prebuilt binaries for VS2008 - there's no need to build them yourself.



  • ok where can i download it . please send to me this link i try to find binaries for vs2008 sp1 but can not find it. i really really tnx if you send all necessary link that i must download them.





  • ok i download and install "Qt libraries 4.7.4 for Windows (VS 2008, 228 MB)" and install it to C:\Qt\4.7.4 now what i must to do ?



  • [quote author="cincirin" date="1323286429"]Try to rename your files. From what I see you have Qt.cpp and Qt.h in your project. And don't use only Qt in your namespaces or class definitions or other defined type.[/quote]

    [quote author="Volker" date="1323301857"]As others already have mentioned, do not name your class Qt! This will conflict with the Qt namespace in the Qt libs itself. Additionally, it's good practice to not prefix your own classes with Q or Qt, as this is informally reserved for Qt's own classes.[/quote]

    You have made these changes ? If yes, you still have errors ? If yes, please post new code with the changes.



  • tnx for all of your answer . i found one video clip in youtube how to install qt in solve my problem tnx alot


Log in to reply
 

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