User forums > Using Code::Blocks
codeblocks+qt 4.2.1
Shakes:
When forming a QT4 project, it will ask you to fill in the compiler variable $(#qt), clicking next will bring up the "Global Variable Editor". Here in the Base fill in the QT directory location, in the include area the whole QT directory location with include suddir and the same for the lib part filling it in with the lib location.
Click close (Bug - it will complain its not a valid path, ignore it. It should be correct as long as QT is in the directory you've set). Then next (change these settings to your liking), then finish.
Once this is done, go into project properties and under build options and check that the Linker and Directories areas have (becareful to check what build settings, Debug/Release or the Project, that you're checking) the:
--- Code: ---$(#qt.include)
$(#qt.include)\GtGui
--- End code ---
in the include area (Note that \ can be replaced with / in WinXp and up. I'd replace it with / if in windows to make the project compatible with linux).
The:
--- Code: ---$(#qt.lib)
--- End code ---
in the Libraries Directory area.
The:
--- Code: ---QtCore4
QtGui4
--- End code ---
in the Linker part. Note here that you may need to add other libraries depending on what classes u use (Assistant docs show the module name under the class names). Important: Windows libraries have 4 appended to them in QT win, in Linux the "4" is NOT present (I dont know if the project wizard is smart enough to spot that).
Finally you can bypass the whole wizard thing by just creating a console app and creating a Global Variable like above and using the string mentioned above in the relevant sections.
If your app compiles and links, but "Cannot find QtCore4.dll" or in Linux "QtCore.so.x not found" when running, then in linux u config the dynamic linker:
Edit your /etc/ld.so.conf file (using admin/su/sudo) and add the Qt lib dir (full path) to it save and then run ldconfig using su again.
In other words (in Debian based linux's):
--- Code: ---sudo nano /etc/ld.so.conf
--- End code ---
then edit the file and save, then
--- Code: ---sudo ldconfig
--- End code ---
Windows: I just copy the dlls to the same directory as the app I created (messy but works :P ). The names of the dlls will be the same as the libraries listed in the Linker part.
Hope that Helps
Peace Out
Shakes
MortenMacFly:
--- Quote from: NGF on November 16, 2006, 10:21:10 pm ---I got a error saying that cannot find QtCore4.dll file.
When I press I get a dos window saying Process returned -1073741515 (0xC0000135) execution time : 2.938 s
--- End quote ---
O dear, when did you say you started programming? A minute ago?! ;-)
Anyway: In the path of your executable (the C::B output folder of your project) is the exe (application) that is going to be launched. Somewhere in another path (where you have installed the QT SDK) is the QtCore4.dll file. You see: You have to bring them together to get a working executable, becasue the executabel *depends* on that DLL. Now you have basically four ways:
1.) Copy the DLL (I believe this is not the only one that is required by your application, just the first that's missing) to the folder of your executable
2.) Extend the PATH environment to the folder, where the QT DLL's are located
3.) Copy the QT DLL's to a folder that is in the path (e.g. %WINDOWS%\system32
4.) Link statically (which maybe the worst option as the application gets a *lot* bigger)
Choose from and try to understand why this is.
In addition: The console window only opens if you run the debug window. In there usually debug output is shown if you have implemented that in *your* application. What you see there is the return code of your application saying an error has occurred. This is true, as the major QT DLL that provides basic functionalities could not be found.
With regards, Morten.
NGF:
I tried the third and guess what-it worked!!! I got a small window with a button saying "Quit". It worked fine. Could you give me some help in creating the gui. How do i create radiobuttons, buttons? I know nothing!
iw2nhl:
--- Quote from: NGF on November 17, 2006, 03:35:49 pm ---Could you give me some help in creating the gui. How do i create radiobuttons, buttons? I know nothing!
--- End quote ---
Qt has an excellent documentation with a lot of fully documented examples.
You can create the GUI in 2 modes:
1) using QtDesigner
2) coding it
The first way is easier and more intuitive and is documented in the section "Qt Designer Manual".
The second way is a little more difficult, but gives you full power and more functions. See "Qt Examples" and start with the "Qt Tutorial" which brings you from a simple "Hello world" window to a full game!
A mixed way exists too: draw the basic GUI with QtDesigner, compile and let Qt generate the C++ code for the GUI, then copy the generated code to your files and start from that. The generated code is very good.
NGF:
Ok! I will try it!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version