News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

CodeBlocks QT4 -- a full example please...

Started by jiapei100, January 02, 2010, 01:16:05 PM

Previous topic - Next topic

jiapei100


Hi:

Here comes an additional question.

My C++/QT4  project runs ok in both Eclipse Galileo and Netbeans 6.8

However, after porting some down to CodeBlocks, project building reports the following error messages:


Quoteobj/Debug/objcrop.o||In function `objCrop':|
/home/jiapei/MyPrograms/codeblocks/aam/objcrop/objcrop.cpp|10|undefined reference to `vtable for objCrop'|
/home/jiapei/MyPrograms/codeblocks/aam/objcrop/objcrop.cpp|10|undefined reference to `vtable for objCrop'|
/home/jiapei/MyPrograms/codeblocks/aam/objcrop/objcrop.cpp|10|undefined reference to `vtable for objCrop'|
/home/jiapei/MyPrograms/codeblocks/aam/objcrop/objcrop.cpp|10|undefined reference to `vtable for objCrop'|
obj/Debug/objcrop.o||In function `~objCrop':|
/home/jiapei/MyPrograms/codeblocks/aam/objcrop/objcrop.cpp|36|undefined reference to `vtable for objCrop'|
obj/Debug/objcrop.o:/home/jiapei/MyPrograms/codeblocks/aam/objcrop/objcrop.cpp|36|more undefined references to `vtable for objCrop' follow|
obj/Debug/objcrop.o||In function `objCrop::tr(char const*, char const*)':|
/home/jiapei/MyPrograms/codeblocks/aam/objcrop/objcrop.h|23|undefined reference to `objCrop::staticMetaObject'|
../utils/bin/Debug/libutils.so||undefined reference to `vtable for CDataPlot'|
../utils/bin/Debug/libutils.so||undefined reference to `CDataPlot::staticMetaObject'|
../utils/bin/Debug/libutils.so||undefined reference to `vtable for CImageView'|
../utils/bin/Debug/libutils.so||undefined reference to `vtable for CAudioAnalysisView'|
||=== Build finished: 11 errors, 0 warnings ===|


It seems to tell that some of the functions declared but not defined.  (by google    http://www.google.co.uk/search?q=+undefined+reference+to+%60vtable+for&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-GB:official&client=firefox-a  )


It's strange that both CodeLite and CodeBlocks report such kind of staffs, but Eclipse / Netbeans /Visual Studio won't .

I know it is only GCC compiler that reports this error. Anything I need to take care of this??

In my case
objcrop is a QT4 project, which depends on my own static library libutils.a
The above error messages seem to tell there are some undefined functions in libutils.a
I double checked project utils, and nothing undefined !!!

What should I do next? Please do help.

Best Regards
JIA

Welcome to Vision Open
[url="http://www.visionopen.com"]http://www.visionopen.com[/url]

stahta01

The linker is MOST LIKELY CORRECT that it is undefined!

Find out what library is not being linked in correctly.
The order libraries are listed matters alot.

This is beginning programming question that is likely to be locked.

For C/C++ Code I would turn ON Full Compiler Logging; see what is wrong.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

NOTE: QT Programming IS NOT really the C++ Programming Languge; the problem could be that Code::Blocks is designed for C++/C and is NOT an QT version of C++ Compatible.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

jiapei100


Thanks for your reply Tim.

Quote from: stahta01 on January 02, 2010, 02:09:50 PM
The linker is MOST LIKELY CORRECT that it is undefined!

Find out what library is not being linked in correctly.
The order libraries are listed matters alot.

This is beginning programming question that is likely to be locked.

Well, I'm pretty sure it's not a library missing issue.

Quote
For C/C++ Code I would turn ON Full Compiler Logging; see what is wrong.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Unfortunately, I found
"Full command line" option Under menu "Settings" -> "Compiler and Debugger" -> "Other Setting" tab
but unable to find "Compiler logging".


Quote
NOTE: QT Programming IS NOT really the C++ Programming Languge; the problem could be that Code::Blocks is designed for C++/C and is NOT an QT version of C++ Compatible.

Yes, I believe this is the case.
QT produces some meta files, which will be used further to produce the final binary executable I think.

Welcome to Vision Open
[url="http://www.visionopen.com"]http://www.visionopen.com[/url]

Jenna

Quote from: jiapei100 on January 02, 2010, 03:03:36 PM
Unfortunately, I found
"Full command line" option Under menu "Settings" -> "Compiler and Debugger" -> "Other Setting" tab
but unable to find "Compiler logging".

It's the first dropdown-box on the "Other settings"-tab.

jiapei100


Oh, yes, thank you !!!!
Now, picked up "Full Command Line"



Quote from: jens on January 02, 2010, 03:24:23 PM
Quote from: jiapei100 on January 02, 2010, 03:03:36 PM
Unfortunately, I found
"Full command line" option Under menu "Settings" -> "Compiler and Debugger" -> "Other Setting" tab
but unable to find "Compiler logging".

It's the first dropdown-box on the "Other settings"-tab.
Welcome to Vision Open
[url="http://www.visionopen.com"]http://www.visionopen.com[/url]