Results 1 to 11 of 11

Thread: Linking QT 3.3 in windows

  1. #1
    Join Date
    Feb 2007
    Posts
    7
    Qt products
    Qt3
    Platforms
    Windows

    Default Linking QT 3.3 in windows

    Hey guys,

    I'm a noobie in using QT. My office uses qt 3.3.4 and i installed it on my home system. I was reading thru the book examples and was trying out the QDialog class code. I use visual Studio 2003. After i use qmake to generate the .pro and the Makefile, i dont know how to compile the program in visual studio using the makefile.

    I tried building without the makefile, but i get linker errors and the book says that there would be linker error as the code has to do something with moc.exe and all. Could anyone help me in this regard?

    THanx

    Siddharth

  2. #2
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking QT 3.3 in windows

    you need to generate a Visual studio solunion file from the pro file. Run

    Qt Code:
    1. qmake -t vcapp
    To copy to clipboard, switch view to plain text mode 
    We can't solve problems by using the same kind of thinking we used when we created them

  3. #3
    Join Date
    Feb 2007
    Posts
    7
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Linking QT 3.3 in windows

    I am not getting the .vcproj file after I execute that command. Also i tried the -t and -o parameters , but in vain. Can i use nmake.exe to use the makefile?

    siddharth

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking QT 3.3 in windows

    Quote Originally Posted by siddharth_univ View Post
    I am not getting the .vcproj file after I execute that command.
    In what directory did you run it? qmake will look for your .pro file in the current directory.

    Quote Originally Posted by siddharth_univ View Post
    Can i use nmake.exe to use the makefile?
    Yes, that's why qmake generates it.

  5. #5
    Join Date
    Feb 2007
    Posts
    7
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Linking QT 3.3 in windows

    well i set the path to the bin directory containg the qmake.exe and i went to the directory containing .pro and makefile and used the qmake in that directory which has the .cpp, .h , .pro and make file. I am actually tryign to learn from the qt 3 gui programming book and in the second chapter it explains on how to create a dialog box with out using the qt designer. When i build, i get linker errors and the book says taht i have to qmake to solve the linker problem.

    So can anyone help me please?

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking QT 3.3 in windows

    Quote Originally Posted by siddharth_univ View Post
    well i set the path to the bin directory containg the qmake.exe and i went to the directory containing .pro and makefile and used the qmake in that directory which has the .cpp, .h , .pro and make file.
    Try doing it from the "Qt Command Prompt" (there should be a link in Start menu that opens it) --- it should set up your evironment.

    Quote Originally Posted by siddharth_univ View Post
    i get linker errors
    Could you post first few error messages?

  7. #7
    Join Date
    Feb 2007
    Posts
    7
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Linking QT 3.3 in windows

    QT_Dialog.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall FindDialog::qt_property(int,int,class QVariant *)" (?qt_property@FindDialog@@UAE_NHHPAVQVariant@@@Z)

    QT_Dialog.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall FindDialog::qt_emit(int,struct QUObject *)" (?qt_emit@FindDialog@@UAE_NHPAUQUObject@@@Z)

    QT_Dialog.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall FindDialog::qt_invoke(int,struct QUObject *)" (?qt_invoke@FindDialog@@UAE_NHPAUQUObject@@@Z)

    QT_Dialog.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall FindDialog::qt_cast(char const *)" (?qt_cast@FindDialog@@UAEPAXPBD@Z)

    QT_Dialog.obj : error LNK2001: unresolved external symbol "public: virtual char const * __thiscall FindDialog::className(void)const " (?className@FindDialog@@UBEPBDXZ)

    QT_Dialog.obj : error LNK2001: unresolved external symbol "public: static class QString __cdecl FindDialog::tr(char const *,char const *)" (?tr@FindDialog@@$$FSA?AVQString@@PBD0@Z)

    QT_Dialog.obj : error LNK2001: unresolved external symbol "public: static class QMetaObject * __cdecl FindDialog::staticMetaObject(void)" (?staticMetaObject@FindDialog@@$$FSAPAVQMetaObject @@XZ)

    QT_Dialog.obj : error LNK2001: unresolved external symbol "protected: void __thiscall FindDialog::FindNext(class QString const &,bool)" (?FindNext@FindDialog@@$$FIAEXABVQString@@_N@Z)

    QT_Dialog.obj : error LNK2001: unresolved external symbol "protected: void __thiscall FindDialog::FindPrev(class QString const &,bool)" (?FindPrev@FindDialog@@$$FIAEXABVQString@@_N@Z)
    C:\QtProgs\QT_Dialog\Debug\QT_Dialog.exe : fatal error LNK1120: 9 unresolved externals


    these arethe linker errors i get..can anyone help me out here?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking QT 3.3 in windows

    Add #include "QT_Dialog.moc" at the end of QT_Dialog.cpp, then re-run qmake and make.

  9. #9
    Join Date
    Feb 2007
    Posts
    7
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Linking QT 3.3 in windows

    I think i'm missing something here. I read that i have to use moc.exe to generate the obj files..I use visual studio 2003..and can you tell me how to use the moc?

    thanx

    siddharth

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking QT 3.3 in windows

    Quote Originally Posted by siddharth_univ View Post
    I use visual studio 2003..and can you tell me how to use the moc?
    I don't use VS, so sunil.thaha will have to answer that.

  11. #11
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Linking QT 3.3 in windows

    Neither do I .

    I used to develop Qt applications using VS 6 but not any more . IIRC I after hand coding / using the qmake -project for creating the Qt .pro file. I ran the qmake -t vcapp in the same directory where pro file is present, and that would give me a .dsp file ( VS 6.0 ).

    Inorder to run the moc on a header file I used the VS integration Toolbar.
    We can't solve problems by using the same kind of thinking we used when we created them

Similar Threads

  1. Deploying with MySQL support under Windows
    By KShots in forum Installation and Deployment
    Replies: 1
    Last Post: 12th October 2006, 09:19
  2. converting unix exe to windows binary
    By deekayt in forum General Programming
    Replies: 2
    Last Post: 17th September 2006, 01:00
  3. Child windows in QCanvas as a canvas item
    By incubator in forum Qt Programming
    Replies: 8
    Last Post: 18th July 2006, 14:50
  4. MDI windows without QWorkspace
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 16th June 2006, 17:15
  5. Replies: 4
    Last Post: 20th February 2006, 09:11

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.