PDA

View Full Version : qt4 compilation problem



aegis
20th February 2007, 23:30
hi, i am new to using qt4...

i have installed qt4 opensource edition and i have also installed ms visual studio 2005...

i try to compile some source code {from the command line} using

qmake -project

qmake project_name.pro

and i get varius compilation errors....

The code that i try to compile is correct because, i basically try to run the examples from "C++ GUI Programming with Qt 4" book....what am i doing wrong, is there a possible conflict betweetn qt and ms visual studio??

plz help!

jacek
21st February 2007, 00:00
is there a possible conflict betweetn qt and ms visual studio??
Yes, the Open Source version for windows works only with MinGW (at least officially).

http://www.qtcentre.org/forum/f-installation-5/t-qt-410-on-visual-studio-2005-2889.html

aegis
21st February 2007, 00:03
Yes, the Open Source version for windows works only with MinGW (at least officially).

http://www.qtcentre.org/forum/f-installation-5/t-qt-410-on-visual-studio-2005-2889.html
but i dont want to use qt with visual studio...i just want to use qt,without uninstalling visual studio...

jacek
21st February 2007, 00:38
i just want to use qt,without uninstalling visual studio...
Oh, I see... in such case there shouldn't be any problem. If you have MinGW installed and Qt knows where it is, it should be enough if you start "Qt 4.x.y Command Prompt" (there should be a link in Start menu) --- it will set your environment correctly.

aegis
21st February 2007, 13:27
unfortunatelly it doesn't work.....and get varius errors.....

aegis
21st February 2007, 13:33
i installed qt4 on another computer with no visual studio, and finally i was able to build the hello qt program!!!

now i am trying another example from the book C++ gui programming with Qt4 and it also gives me compilation errors...




#include <QApplication>
#include <QDialog>
#include "ui_gotocelldialog.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Ui::GoToCellDialog ui;
QDialog *dialog = new QDialog;
ui.setupUi(dialog);
dialog->show();
return app.exec();
}



i have named the main form as GoToCellDialogm, and although this program doesn't do anything, i expected to have no problems compiling it....




C:\QT programming\test>make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/QT programming/test'
c:\Qt\4.2.2\bin\uic.exe test.ui -o ui_test.h
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runt
ime-pseudo-reloc -Wl,-subsystem,windows -o "debug\test.exe" -L"c:\Qt\4.2.2\lib
" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
c:\Qt\4.2.2\lib/libqtmaind.a(qtmain_win.o)(.text+0xd): In function `Z13qAtomicSe
tPtrIP16QVectorTypedDataIPcEET_PVS4_S4_':
C:/Qt/4.2.2/include/QtCore/../../src/corelib/tools/qvector.h: undefined referenc
e to `std::string::size() const'
c:\Qt\4.2.2\lib/libqtmaind.a(qtmain_win.o)(.text+0x60):C:/Qt/4.2.2/include/QtCor
e/../../src/corelib/tools/qvector.h: undefined reference to `std::string::operat
or[](unsigned int) const'
c:\Qt\4.2.2\lib/libqtmaind.a(qtmain_win.o)(.text+0x9f):C:/Qt/4.2.2/include/QtCor
e/../../src/corelib/tools/qvector.h: undefined reference to `std::string::operat
or[](unsigned int) const'
c:\Qt\4.2.2\lib/libqtmaind.a(qtmain_win.o)(.text+0xce):C:/Qt/4.2.2/include/QtCor
e/../../src/corelib/tools/qvector.h: undefined reference to `std::string::operat
or[](unsigned int) const'
c:\Qt\4.2.2\lib/libqtmaind.a(qtmain_win.o)(.text+0x10f): In function `WinMain':
C:/Qt/4.2.2/src/winmain/qtmain_win.cpp:68: undefined reference to `__gxx_persona
lity_sj0'
c:\Qt\4.2.2\lib/libqtmaind.a(qtmain_win.o)(.text+0x30b):C:/Qt/4.2.2/src/winmain/
qtmain_win.cpp:105: undefined reference to `qMain(int, char**)'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\test.exe] Error 1
mingw32-make[1]: Leaving directory `C:/QT programming/test'
mingw32-make: *** [debug] Error 2



is the code wrong??

jacek
21st February 2007, 21:13
These errors are really weird. Does it compile if you invoke "make -f Makefile.Release"?

Did you compile the debug version of Qt libraries yourself?

Shoji
21st February 2007, 22:27
[. . . ]it should be enough if you start "Qt 4.x.y Command Prompt" (there should be a link in Start menu) --- it will set your environment correctly.

The Readme that comes with Qt 4.2.2 Commercial version has the following paragraph:


DEMOS AND EXAMPLES

Once Qt is installed, we suggest that you take a look at the demos and
examples to see Qt in action. Run the Qt Examples and Demos either by
typing 'qtdemo' on the command line or through the desktop's Start
menu. On Mac OS X, you can find it in /Developers/Applications/Qt.


I just downloaded the Win commercial evaluation version 4.2.2 of Qt. Started the Tutorial and kept getting errors based on the environment variables not being set. I found this quote from Jacek to be a necessary step in getting the environment set up properly. Tutorial t1 doesn't seem to mention this tip, either. I'm glad Jacek mentioned this tip, which may be unnecessary to most people, but not to me.

I suggest this Readme paragraph and the tutorial would be good places to state that the environment is set up by using the command-line option in the Start Menu. The way this paragraph reads now, it appears that going to Start/Run/Command would be acceptable; sadly, this is not the case.

Thanks to Jacek. Glad you're here.

jacek
21st February 2007, 22:54
I suggest this Readme paragraph and the tutorial would be good places to state that the environment is set up by using the command-line option in the Start Menu.
Make sure you send that suggestion to the Trolls.

aegis
23rd February 2007, 00:10
These errors are really weird. Does it compile if you invoke "make -f Makefile.Release"?

Did you compile the debug version of Qt libraries yourself?
sorry i can't test your suggestion, because i formated the computer and made a clean installation of everything but visual studio....now i re-wrote the same code and it worked!!!

i hope that i can now finish the book on qt4 without any problems...

thanks again for your help!!!