Author Topic: C::B + QT4  (Read 10432 times)

dr23

  • Guest
C::B + QT4
« on: September 25, 2006, 11:23:55 pm »
Hi,
I would like to start a software but using c::B
I'm on Kubuntu Dapper and  download the last nightly built. Don't tell me bugs could appears... I know.
But I chose a empty projet because when i select QT4 project it say that c:b can't find Qt4core Lib whereas QT4 is successfuly installed.
But i would like to add QT include in order to have completion code.
How i do that ? I searched in Project Properties but i did not find something like "include".
Thaks for help

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: C::B + QT4
« Reply #1 on: September 26, 2006, 10:11:32 am »
Did you search the Build options? There you will find the includes (second tab)
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline dk

  • Advanced newcomer
  • *
  • Posts: 55
    • Code::Blocks for ALT Linux Sisyphus
Re: C::B + QT4
« Reply #2 on: September 26, 2006, 04:42:33 pm »
But I chose a empty projet because when i select QT4 project it say that c:b can't find Qt4core Lib whereas QT4 is successfuly installed.
QT4 Wizard doesn't work fine in Linux. You should configure QT4 Wizard for your system.
Edit files /usr/share/codeblocks/templates/qt.cbp and /usr/share/codeblocks/templates/wizard/qt4/wizard.script

You should set correct filenames for .a libraries and correct path to QT4 directory.

For example, I've used the next patch for my system (ALT Linux Sisyphus):
Code: [Select]
--- codeblocks-1.0/src/plugins/scriptedwizard/resources/qt4/wizard.script.orig  2006-08-28 14:49:50 +0400
+++ codeblocks-1.0/src/plugins/scriptedwizard/resources/qt4/wizard.script       2006-08-28 14:51:41 +0400
@@ -5,10 +5,10 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 // globals
-QtPathDefault    <- _T("$(#qt)");
-QtPathDefaultInc <- _T("$(#qt.include)");
-QtPathDefaultLib <- _T("$(#qt.lib)");
-QtPath <- _T("");
+QtPathDefault    <- _T("/usr/lib/qt4");
+QtPathDefaultInc <- _T("/usr/lib/qt4/include");
+QtPathDefaultLib <- _T("/usr/lib/qt4/lib");
+QtPath <- _T("/usr/lib/qt4");
 
 function BeginWizard()
 {
@@ -52,7 +52,7 @@
         local dir_nomacro_lib = GetCompilerLibDir(dir, QtPathDefault, QtPathDefaultLib);
         if (dir_nomacro_lib.IsEmpty())
             return false;
-        if (!VerifyLibFile(dir_nomacro_lib, _T("QtCore4"), _T("Qt's"))) return false;
+        if (!VerifyLibFile(dir_nomacro_lib, _T("QtCore"), _T("Qt's"))) return false;
 
 
         QtPath = dir; // Remember the original selection.
@@ -93,8 +93,8 @@
     project.AddLibDir(QtPathDefaultLib);
 
     // add link libraries
-    project.AddLinkLib(_T("QtCore4"));
-    project.AddLinkLib(_T("QtGui4"));
+    project.AddLinkLib(_T("QtCore"));
+    project.AddLinkLib(_T("QtGui"));
 
     // enable compiler warnings (project-wide)
     WarningsOn(project, Wizard.GetCompilerID());

--- codeblocks-1.0/src/templates/common/qt.cbp.orig     2006-08-28 11:46:22 +0400
+++ codeblocks-1.0/src/templates/common/qt.cbp  2006-08-28 14:23:10 +0400
@@ -32,17 +32,13 @@
                                        <Add option=""/>
                                </Compiler>
                                <Linker>
-                                       <Add library="libQt3Support4.a"/>
-                                       <Add library="libQtAssistantClient.a"/>
-                                       <Add library="libQtCore4.a"/>
-                                       <Add library="libQtDesigner4.a"/>
-                                       <Add library="libQtDesignerComponents4.a"/>
-                                       <Add library="libQtGui4.a"/>
-                                       <Add library="libqtmain.a"/>
-                                       <Add library="libQtNetwork4.a"/>
-                                       <Add library="libQtOpenGl4.a"/>
-                                       <Add library="libQtSql4.a"/>
-                                       <Add library="libQtXml4.a"/>
+                                       <Add library="libQt3Support.a"/>
+                                       <Add library="libQtCore.a"/>
+                                       <Add library="libQtGui.a"/>
+                                       <Add library="libQtNetwork.a"/>
+                                       <Add library="libQtOpenGl.a"/>
+                                       <Add library="libQtSql.a"/>
+                                       <Add library="libQtXml.a"/>
                                        <Add directory="$QTDIR/lib"/>
                                        <Add option=""/>
                                </Linker>                       
Denis Kirienko
C::B maintainer for ALT Linux distribution (http://www.sisyphus.ru/srpm/codeblocks)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 8695
Re: C::B + QT4
« Reply #3 on: September 26, 2006, 05:19:25 pm »
// globals
-QtPathDefault    <- _T("$(#qt)");
-QtPathDefaultInc <- _T("$(#qt.include)");
-QtPathDefaultLib <- _T("$(#qt.lib)");
-QtPath <- _T("");
+QtPathDefault    <- _T("/usr/lib/qt4");
+QtPathDefaultInc <- _T("/usr/lib/qt4/include");
+QtPathDefaultLib <- _T("/usr/lib/qt4/lib");
+QtPath <- _T("/usr/lib/qt4");
This (and a few other things) I don't like. The above will work if you define qt as global variable. But with your patch applied it's of very limited functionality. But this won't work on any other system where e.g. the libs are not under /usr/lib/qt4 (and there are many of those) and for sure not on Windows. That's why you define it as global variable - a user can then choose where the libs are on it's particular system independent of the OS.

In addition: Did you notice that this is a qt4 wizard? Correct me, if I'm wrong, but isn't there the lib name with a "4"?

With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline dk

  • Advanced newcomer
  • *
  • Posts: 55
    • Code::Blocks for ALT Linux Sisyphus
Re: C::B + QT4
« Reply #4 on: September 26, 2006, 05:45:54 pm »
This (and a few other things) I don't like. The above will work if you define qt as global variable. But with your patch applied it's of very limited functionality. But this won't work on any other system where e.g. the libs are not under /usr/lib/qt4 (and there are many of those) and for sure not on Windows. That's why you define it as global variable - a user can then choose where the libs are on it's particular system independent of the OS.

Yes, of course! But this patch was made only for my favorite Linux distribution. And now you may find the rpm with this patch in the ALT Linux sisyphus repository. I don't plan to use it at the other systems. So, it is more easy to set absolute path to QT4 dir, than defining system-wide variable.

Quote
In addition: Did you notice that this is a qt4 wizard? Correct me, if I'm wrong, but isn't there the lib name with a "4"?
In my distribution there are no suffixes "4" in QT4 library names:
Code: [Select]
$ ls /usr/lib/qt4/lib/*.a
/usr/lib/qt4/lib/libQt3Support.a  /usr/lib/qt4/lib/libQtNetwork.a  /usr/lib/qt4/lib/libQtSvg.a
/usr/lib/qt4/lib/libQtCore.a      /usr/lib/qt4/lib/libQtOpenGL.a   /usr/lib/qt4/lib/libQtXml.a
/usr/lib/qt4/lib/libQtGui.a       /usr/lib/qt4/lib/libQtSql.a
Denis Kirienko
C::B maintainer for ALT Linux distribution (http://www.sisyphus.ru/srpm/codeblocks)

Offline Methedrine

  • Advanced newcomer
  • *
  • Posts: 11
  • Wearing Cheap Shades
Re: C::B + QT4
« Reply #5 on: September 26, 2006, 07:47:29 pm »

In addition: Did you notice that this is a qt4 wizard? Correct me, if I'm wrong, but isn't there the lib name with a "4"?

With regards, Morten.

IIRC the unix convention is to put the 4 into the path (f.e. /usr/lib/qt4), and the windoze one is adding it to the filename (i.e. qtgui4.dll)
Some people get by with a little understanding, some people get by with a whole lot more ...