User forums > Using Code::Blocks

Using Qt

(1/3) > >>

bfr:
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:


--- Code: ---/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

--- End code ---

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.

kenneth.balslev:
Yeah, I got it to work..

You may want to take a look at this thread:

http://forums.codeblocks.org/index.php/topic,2253.0.html

There are some odd issues with Qt on C::B. For example, you have to create a Debug and Release folder in the project folder - not under the Bin folder (which is the default). Additionally, once I have built my Qt projects, I have been unsuccesful in re-building them (I get a strange error message). Only when I delete the contents of the Debug and Release folders, I can succesfully build my Qt application again. I don't know if anybody else had the same experience?

yop:
I 've seen all these issues and I 'm working towards them in QtWorkbench. I have already finished a first .pro parser version, the .pro generator and I am fixing the project options dialog and the build sytem (the later will be much simpler than before). The configuration dialog is also ready. These sources are not in the "official" svn as they break the plugin, but will be in the next few days if my day job continues to run smoothly.
The main thing that we have to address is to achieve some kind of compatibility between the C::B build system and the way qmake generates Makefiles. The solution I came up with is to produce different .pro files in the top level project directory for each target. The obvious solution of SUBDIR entries is doomed by default unfortunatelly because C::B projects don't prerequisite that a respective folder will exist for each target while qmake expects that. Also since the qmake generated Makefiles dive into subdirs during builds you get broken debugger functionality. I could name numerous more little inconviniences while trying to use Qt with C::B and that's why I started with the plugin in the first place. The main thing was that I knew the weaknesses of the plugin and I could/can adopt my projects to be "friendly" with it. This is not the case with the user that just wants the plugin to work out of the box without having to know it's internals. These are the issues I am working on and the results are encouraging. Of course untill I get it to be stable there will still be little anoyances, if you can all bare with them and provide some feedback it would be nice. Untill then the following post describes how to set up QtWorkbench projects as it is now:
http://forums.codeblocks.org/index.php/topic,2253.msg45295.html#msg45295

bfr:
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:


--- Code: ---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 ===

--- End code ---

Whenever I use Q_OBJECT, I think.  My code is at http://rafb.net/p/RJk0f872.html .

yop:
Remove your Makefiles. You have to rerun qmake after making sure that everything that is derived from QObject has the Q_OBJECT macro in the class header. This is a classical error of not generated (and compiled and linked) moc source files.

Navigation

[0] Message Index

[#] Next page

Go to full version