Has anybody here gotten Qt to fully work with Code::Blocks? Even with the QtWorkBench plugin, I haven't gotten a program to succesfully build and run. I have gotten code to work that doesn't require the Meta Object Compiler (MOC) to be run, but if I use something like Q_OBJECT that requires the Meta Object Compiler, it doesn't work. Right now, I'm getting:
/usr/bin/sh: -c: line 2: syntax error: unexpected end of file
mingw32-make.exe: *** [Release\Makefile] Error 258
Process terminated with status 2 (0 minutes, 14 seconds)
0 errors, 0 warnings
When trying to compile the default code that the Qt template in Code::Bocks generates.
Oh, and by the way, I've tried Qt 4.2.3 and Qt 3 Release Candidate 1, and niether have worked.
OK, thanks. After creating Release and Debug folders in the project directory, though and compiling with the QtWorkBench plugin, it still didn't work (I got the same error as in my first post). I guess I'll just wait a few days for the next release of the QtWorkBench plugin, and see if that works.
Is there anything in particular I have to do with the /obj directory and what is in it?
EDIT: I kind of got it to work. I still get:
objReleasemain.o:main.cpp:(.text+0x68):: undefined reference to `vtable for MainWindow'
objReleasemain.o:main.cpp:(.text+0x6f):: undefined reference to `vtable for MainWindow'
objReleasemain.o:main.cpp:(.text+0xdf):: undefined reference to `MainWindow::staticMetaObject'
objReleasemain.o:main.cpp:(.text+0x17f):: undefined reference to `MainWindow::staticMetaObject'
objReleasemain.o:main.cpp:(.text+0x3c8):: undefined reference to `vtable for MainWindow'
objReleasemain.o:main.cpp:(.text+0x3cf):: undefined reference to `vtable for MainWindow'
objReleasemain.o:main.cpp:(.text+0x444):: undefined reference to `MainWindow::staticMetaObject'
objReleasemain.o:main.cpp:(.text+0x4ec):: undefined reference to `MainWindow::staticMetaObject'
objReleasemain.o:main.cpp:(.text+0x77e):: undefined reference to `vtable for MainWindow'
objReleasemain.o:main.cpp:(.text+0x785):: undefined reference to `vtable for MainWindow'
objReleasemain.o:main.cpp:(.text+0x7e1):: undefined reference to `vtable for MainWindow'
objReleasemain.o:main.cpp:(.text+0x7f5):: undefined reference to `vtable for MainWindow'
:: === Build finished: 12 errors, 0 warnings ===
Whenever I use Q_OBJECT, I think. My code is at http://rafb.net/p/RJk0f872.html .
Thanks for your help. I did what kenneth.balslev said to do, along with what you (yop) said to do, but now I'm getting:
/usr/bin/sh: -c: line 2: syntax error: unexpected end of file
mingw32-make.exe: *** [Release\Makefile] Error 258
Process terminated with status 2 (0 minutes, 0 seconds)
0 errors, 0 warnings
Will this be fixed in a future release of the QtWorkBench plugin? If so, how long do you estimate it will take for this future version to be released?
I'm getting some errors:
:: === QtWorkbench, default ===
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.cpp:9: sdk.h: No such file or directory
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.cpp:10: annoyingdialog.h: No such file or directory
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:19: cbplugin.h: No such file or directory
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:22: error: expected class-name before '{' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:58: error: ISO C++ forbids declaration of `cbConfigurationPanel' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:58: error: `cbConfigurationPanel' declared as a `virtual' field
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:58: error: expected `;' before '*' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:67: error: ISO C++ forbids declaration of `cbConfigurationPanel' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:67: error: `cbConfigurationPanel' declared as a `virtual' field
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:67: error: expected `;' before '*' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:79: error: expected `;' before "virtual"
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:96: error: expected `,' or `...' before "type"
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:96: error: ISO C++ forbids declaration of `ModuleType' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:136: error: `CodeBlocksEvent' has not been declared
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:136: error: ISO C++ forbids declaration of `event' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:140: error: ISO C++ forbids declaration of `cbProject' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:140: error: expected `;' before '*' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:51: error: `cgContribPlugin' was not declared in this scope
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtworkbench.h:51: warning: unused variable 'cgContribPlugin'
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:12: settings.h: No such file or directory
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:13: cbproject.h: No such file or directory
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:14: compiler.h: No such file or directory
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: expected initializer before '*' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' was not declared in this scope
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: typedef `CMPFUNC_wxArrayTargets_Array' is initialized (use __typeof__ instead)
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' was not declared in this scope
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `pItem1' was not declared in this scope
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' was not declared in this scope
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `pItem2' was not declared in this scope
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: ISO C++ forbids declaration of `_wxArrayTargets_Array' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: expected `;' before '&' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: expected `;' before "_wxArrayTargets_Array"
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: ISO C++ forbids declaration of `_wxArrayTargets_Array' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: expected `;' before '&' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: expected `;' before "_wxArrayTargets_Array"
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: ISO C++ forbids declaration of `_wxArrayTargets_Array' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: expected `;' before '&' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: expected `;' before "int"
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' has not been declared
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: ISO C++ forbids declaration of `lItem' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' has not been declared
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: ISO C++ forbids declaration of `lItem' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' has not been declared
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: ISO C++ forbids declaration of `lItem' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' has not been declared
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: ISO C++ forbids declaration of `lItem' with no type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' does not name a type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' does not name a type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:17: error: `_wxArrayTargets_Array' does not name a type
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:18: error: expected initializer before '*' token
C:\Documents and Settings\Owner\Desktop\QTWB\src\qtwprogenerator.h:18: error: `_wxArrayFiles_Array' was not declared in this scope
:: More errors follow but not being shown.
:: Edit the max errors limit in compiler options...
:: === Build finished: 50 errors, 1 warnings ===
Where do I get sdk.h and cbplugin.h?
EDIT: I think I have to download the Code::Blocks source...?
I've been trying for quite a while to get Qt to fully work. It works...until I use stuff like Q_OBJECT, which makes me get:
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x164):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x263):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x3c8):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x4e9):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x5f3):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x4ef4):: undefined reference to `vtable for MainWindow'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x4efb):: undefined reference to `vtable for MainWindow'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x4fd1):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x5241):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x5299):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x5554):: undefined reference to `vtable for MainWindow'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x555b):: undefined reference to `vtable for MainWindow'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x5631):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x58a1):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\mainwindow.o:mainwindow.cpp:(.text+0x58f9):: undefined reference to `MainWindow::staticMetaObject'
obj\Release\main.o:main.cpp:(.text+0xd9):: undefined reference to `vtable for MainWindow'
obj\Release\main.o:main.cpp:(.text+0xe7):: undefined reference to `vtable for MainWindow'
obj\Release\main.o:main.cpp:(.text+0x15f):: undefined reference to `vtable for MainWindow'
obj\Release\main.o:main.cpp:(.text+0x164):: undefined reference to `vtable for MainWindow'
:: === Build finished: 19 errors, 0 warnings ===
I have the latest version of the QtWorkBench plugin. I have the June 28th build of Code::Blocks.
WhiteStarLine: What IDE did you end up getting?