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
Re: Linking QT 3.3 in windows
you need to generate a Visual studio solunion file from the pro file. Run
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
Re: Linking QT 3.3 in windows
Quote:
Originally Posted by
siddharth_univ
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
Can i use nmake.exe to use the makefile?
Yes, that's why qmake generates it.
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?
Re: Linking QT 3.3 in windows
Quote:
Originally Posted by
siddharth_univ
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
i get linker errors
Could you post first few error messages?
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?
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.
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
Re: Linking QT 3.3 in windows
Quote:
Originally Posted by
siddharth_univ
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.
Re: Linking QT 3.3 in windows
Neither do I ;).
I used to develop Qt applications using VS 6 but not any more :D. 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.