PDA

View Full Version : Qt 4.7.1 compiler issues



joemcg
12th August 2011, 19:07
Hi everyone, this is my first post here, and subsequently my first attempt at using Qt to do anything.

I'm really just trying to go through code examples to get a grip on the language/environment, etc. The tutorial I was using is on

http://www.digitalfanatics.org/projects/qt_tutorial/chapter01.html

OK, firstly, I am running windows 7, and I installed Qt from the open-source zip file since I have microsoft VS 2010 on my machine. Then I installed the plug-in for VS2010. When I run through examples in Qt Creator, those all run fine. When I try to compile these other examples from the command line, I run into some problems, which I am hoping some light can be shed upon.

I created the *.h, *.cpp, and main.cpp files as presented in the link above, changing the QVBox to Q3Vbox in all places for the backwards compatibility. Also, in my path variable, I included the paths to the \bin and every directory in \include just to be sure. So, from the command line in my directory with these files I run

qmake -project
qmake
mingw32-make

since I have mingw32 (g++) set as my compiler. when I run the g++ compiler, I get the following error messages:


$ mingw32-make
C:/MinGW/bin/mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/qt/4.7.1/joeexamples'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -
DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'c:/Qt/4.7
.1/include/QtCore' -I'c:/Qt/4.7.1/include/QtGui' -I'c:/Qt/4.7.1/include' -I'.' -
I'c:/Qt/4.7.1/include/ActiveQt' -I'tmp/moc/debug_shared' -I'c:/Qt/4.7.1/mkspecs/
win32-g++' -o tmp/obj/debug_shared/main.o main.cpp
In file included from main.cpp:3:0:
mywidget.h:4:20: fatal error: q3vbox.h: No such file or directorycompilation terminated.
mingw32-make[1]: *** [tmp/obj/debug_shared/main.o] Error 1
mingw32-make[1]: Leaving directory `C:/qt/4.7.1/joeexamples'
mingw32-make: *** [debug-all] Error 2

in red there, I'm not sure if this is my ONLY problem, but I can't see why it can't find the file?

Thanks!

Added after 10 minutes:

Wow.. solved. If anyone experiences similar things, add this to your .pro file:

QT += qt3support

otherwise the qt3 libraries won't be included. Also, be sure to examine some of the objects you may get errors on.

Cheers

marcvanriet
13th August 2011, 13:06
Hi,
A bit strange... you have MSVC, but you are building with MingW. Why ? You can download Qt pre-build for MSVC as well (from Qt-Nokia downloads (http://qt.nokia.com/downloads).

There are Qt 4.x books available online, I would suggest using those instead of the older tutorials. See Free Qt4.x book (http://linuxandfriends.com/2008/06/20/free-download-of-qt-4c-book/)

Also, it is a LOT easier to use QtCreator when you are just starting with Qt. The free plugin for MSVC has only limited functionality, so you still have to figure some things out by yourself. Using Qt Creator, everything just works out-of-the-box. Then you can start using Qt immediately, instead of first having to struggle with the toolchain. After you get more familiar with Qt, you can still switch back to using Visual Studio if you want.

Best regards,
Marc