PDA

View Full Version : Tutorial 7 and Dev-C++



swarm32
2nd December 2007, 00:09
Setup: Dev-C++ 4.9.9.2 & Qt 4.3.2 on Windows 2000 SP4
Used these sites to help me set up QT & Dev: http://darkhack.googlepages.com/qttutorial ; http://www2.norwich.edu/mfenner/SE/final-iteration/futher-qt-notes.html

Exact tutorial version: http://doc.trolltech.com/4.3/tutorial-t7.html

When I go to compile I get this lovely message:

[Linker error] undefined reference to `vtable for LCDRange'
[Linker error] undefined reference to `vtable for LCDRange'
[Linker error] undefined reference to `vtable for LCDRange'
[Linker error] undefined reference to `vtable for LCDRange'
ld returned 1 exit status
C:\is301\qt\ch7\Makefile.win [Build Error] [tutch7.exe] Error 1

My Compiler output looks like this:

Compiler: Default compiler
Building Makefile: "C:\is301\qt\ch7\Makefile.win"
Executing make clean
rm -f main.o lcdrange.o tutch7_private.res tutch7.exe
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:\Qt\4.3.2\include\QtGui" -I"C:\Qt\4.3.2\include\QtCore" -I"C:\Qt\4.3.2\include" -I"." -I"C:\Qt\4.3.2\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"C:\Qt\4.3.2\mkspecs\win32-g++"
g++.exe -c lcdrange.cpp -o lcdrange.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"C:\Qt\4.3.2\include\QtGui" -I"C:\Qt\4.3.2\include\QtCore" -I"C:\Qt\4.3.2\include" -I"." -I"C:\Qt\4.3.2\include\ActiveQt" -I"tmp\moc\release_shared" -I"." -I"C:\Qt\4.3.2\mkspecs\win32-g++"
windres.exe -i tutch7_private.rc --input-format=rc -o tutch7_private.res -O coff
g++.exe main.o lcdrange.o tutch7_private.res -o "tutch7.exe" -L"C:/Dev-Cpp/lib" -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows -L"C:/Qt/4.3.2/lib" -L"C:/Qt/4.3.2/bin" -lmingw32 -lqtmain -lQtCore4 -lQtGui4
lcdrange.o(.text+0x69):lcdrange.cpp: undefined reference to `vtable for LCDRange'
lcdrange.o(.text+0x70):lcdrange.cpp: undefined reference to `vtable for LCDRange'
lcdrange.o(.text+0x309):lcdrange.cpp: undefined reference to `vtable for LCDRange'
lcdrange.o(.text+0x310):lcdrange.cpp: undefined reference to `vtable for LCDRange'
collect2: ld returned 1 exit status
make.exe: *** [tutch7.exe] Error 1
Execution terminated


If I try to manually compile I run into a different problem:

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\is301\qt\ch7>PATH=C:\Dev-Cpp\bin;C:\Qt\4.3.2\bin

C:\is301\qt\ch7>qmake -project

C:\is301\qt\ch7>qmake

C:\is301\qt\ch7>make
make -f Makefile.Release
make[1]: Entering directory `C:/is301/qt/ch7'
make[1]: Nothing to be done for `first'.
make[1]: Leaving directory `C:/is301/qt/ch7'

C:\is301\qt\ch7>
Tried to do what was suggested here (http://www.qtcentre.org/forum/archive/index.php/t-567.html) but the errors just got uglier.

Any ideas?

jacek
2nd December 2007, 19:06
What happens when you run "make clean" and then "make" from the console?

swarm32
2nd December 2007, 20:14
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\is301\qt\ch7>PATH=C:\Qt\4.3.2\bin;C:\Dev-Cpp\bin

C:\is301\qt\ch7>make clean
mingw32-make -f Makefile.Release clean
mingw32-make[1]: Entering directory `C:/is301/qt/ch7'
del release\moc_lcdrange.cpp
del release\lcdrange.o release\main.o release\moc_lcdrange.o
mingw32-make[1]: Leaving directory `C:/is301/qt/ch7'
mingw32-make -f Makefile.Debug clean
mingw32-make[1]: Entering directory `C:/is301/qt/ch7'
del debug\moc_lcdrange.cpp
del debug\lcdrange.o debug\main.o debug\moc_lcdrange.o
mingw32-make[1]: Leaving directory `C:/is301/qt/ch7'

C:\is301\qt\ch7>make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/is301/qt/ch7'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS
_QMAIN -I"..\..\..\Qt\4.3.2\include\QtCore" -I"..\..\..\Qt\4.3.2\include\QtCore"
-I"..\..\..\Qt\4.3.2\include\QtGui" -I"..\..\..\Qt\4.3.2\include\QtGui" -I"..\.
.\..\Qt\4.3.2\include" -I"." -I"c:\Qt\4.3.2\include\ActiveQt" -I"release" -I"."
-I"..\..\..\Qt\4.3.2\mkspecs\default" -o release\lcdrange.o lcdrange.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS
_QMAIN -I"..\..\..\Qt\4.3.2\include\QtCore" -I"..\..\..\Qt\4.3.2\include\QtCore"
-I"..\..\..\Qt\4.3.2\include\QtGui" -I"..\..\..\Qt\4.3.2\include\QtGui" -I"..\.
.\..\Qt\4.3.2\include" -I"." -I"c:\Qt\4.3.2\include\ActiveQt" -I"release" -I"."
-I"..\..\..\Qt\4.3.2\mkspecs\default" -o release\main.o main.cpp
C:\Qt\4.3.2\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\Qt\4
.3.2\include\QtCore" -I"..\..\..\Qt\4.3.2\include\QtCore" -I"..\..\..\Qt\4.3.2\i
nclude\QtGui" -I"..\..\..\Qt\4.3.2\include\QtGui" -I"..\..\..\Qt\4.3.2\include"
-I"." -I"c:\Qt\4.3.2\include\ActiveQt" -I"release" -I"." -I"..\..\..\Qt\4.3.2\mk
specs\default" -D__GNUC__ -DWIN32 lcdrange.h -o release\moc_lcdrange.cpp
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS
_QMAIN -I"..\..\..\Qt\4.3.2\include\QtCore" -I"..\..\..\Qt\4.3.2\include\QtCore"
-I"..\..\..\Qt\4.3.2\include\QtGui" -I"..\..\..\Qt\4.3.2\include\QtGui" -I"..\.
.\..\Qt\4.3.2\include" -I"." -I"c:\Qt\4.3.2\include\ActiveQt" -I"release" -I"."
-I"..\..\..\Qt\4.3.2\mkspecs\default" -o release\moc_lcdrange.o release\moc_lcdr
ange.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o "release\ch7.exe" release\lcdr
ange.o release\main.o release\moc_lcdrange.o -L"c:\Qt\4.3.2\lib" -lmingw32 -lqt
main -lQtGui4 -lQtCore4
mingw32-make[1]: Leaving directory `C:/is301/qt/ch7'

C:\is301\qt\ch7>

For S&G after looking at the output I did this:


C:\is301\qt\ch7>cd release

C:\is301\qt\ch7\release>dir /w
Volume in drive C has no label.
Volume Serial Number is 0884-CE14

Directory of C:\is301\qt\ch7\release

[.] [..] ch7.exe lcdrange.o
main.o moc_lcdrange.cpp moc_lcdrange.o
5 File(s) 63,371 bytes
2 Dir(s) 5,844,787,200 bytes free

C:\is301\qt\ch7\release>ch7.exe

C:\is301\qt\ch7\release>

It appears that the manual method does create a valid example. Any idea how to get Dev-C++ to behave? Or should I go back to using Crimson Editor and batch files?

Thanks in advance.

jacek
2nd December 2007, 21:16
Any idea how to get Dev-C++ to behave?
I don't use it, but you should be able to force it to run makefiles generated by qmake. Of course this means that you will have to edit the .pro file by hand and run qmake from time to time, but maybe there is some kind of plugin that does this.