Author Topic: CodeBlocks QT4 -- a full example please...  (Read 8001 times)

Offline jiapei100

  • Multiple posting newcomer
  • *
  • Posts: 20
    • Vision Open
CodeBlocks QT4 -- a full example please...
« on: January 02, 2010, 01:16:05 pm »

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:


Quote
obj/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
http://www.visionopen.com

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7789
    • My Best Post
Re: CodeBlocks QT4 -- a full example please...
« Reply #1 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.

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++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jiapei100

  • Multiple posting newcomer
  • *
  • Posts: 20
    • Vision Open
Re: CodeBlocks QT4 -- a full example please...
« Reply #2 on: January 02, 2010, 03:03:36 pm »

Thanks for your reply Tim.

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
http://www.visionopen.com

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: CodeBlocks QT4 -- a full example please...
« Reply #3 on: January 02, 2010, 03:24:23 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.

Offline jiapei100

  • Multiple posting newcomer
  • *
  • Posts: 20
    • Vision Open
Re: CodeBlocks QT4 -- a full example please...
« Reply #4 on: January 02, 2010, 03:58:39 pm »

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



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
http://www.visionopen.com