Author Topic: [Please Help]cant build QT4 application after installation.  (Read 5780 times)

ko9ko9ko9

  • Guest
[Please Help]cant build QT4 application after installation.
« on: January 09, 2007, 12:30:30 pm »
Hi, i just getting into QT4/C++ and try to run the sample program from the code blocks template

After I installed everything it seems not working (cant build/run) :(

My OS: Windows XP Home Edition
Code Blocks Version i am using:codeblocks-1.0rc2.exe (without MinGw compiler)
Qt4 version:qt-win-opensource-4.2.1-mingw

I also set up my system environment variables (System Variable not User Variable):
Path : C:\Qt\4.2.1\bin;C:\MinGW\bin;C:\WINDOWS\System32
QMAKESPEC : win32-g++
QTDIR : C:\QT\4.2.1

Also after installation of both i went to the QT4 and build the debug library (took real long time) and restart.


The following are the error showing:

==================================================
Project   : QT Application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\John Chiu\My Documents\
--------------------------------------------------------------------------------
Switching to target: default
Linking executable: C:\Documents and Settings\John Chiu\My Documents\QTapp.exe
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lQtAssistantClient
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

==========================================================



The Code i am using is the following:

=======================================================
#include <qstring.h>
#include <qapplication.h>
#include <qpushbutton.h>

int main(int argc, char **argv)
{
    QApplication    app(argc, argv);
    QPushButton     quit("Hello World!");
   
    quit.resize(300, 40);
    quit.setFont(QFont("Arial", 18, QFont::Bold));
    QObject::connect(&quit, SIGNAL(clicked()), &app, SLOT(quit()));
    quit.show();
   
    return app.exec();
}

======================================================


Can anyone tell me what went wrong? I think my installation is on right track right??.....or not ( :( :( :( :()



Please help me Please Please  :shock:


Offline oz

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: [Please Help]cant build QT4 application after installation.
« Reply #1 on: January 09, 2007, 01:14:35 pm »
try a nightly build should work well, Qt4.2 has been changed compare with previous releases.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: [Please Help]cant build QT4 application after installation.
« Reply #2 on: January 09, 2007, 01:45:48 pm »
Quote
ld.exe: cannot find -lQtAssistantClient
Looks like you forgot to add a library path. Adding the correct path should make it work even with RC2 (although it is true that nightly builds work better).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: [Please Help]cant build QT4 application after installation.
« Reply #3 on: January 09, 2007, 02:21:40 pm »
I wonder if the library "QtAssistantClient" exists at all?! The time RC2 came out there was no QT4 yet. And I believe these libs are now named something like "QtAssistantClient4" under Windows.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oz

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: [Please Help]cant build QT4 application after installation.
« Reply #4 on: January 09, 2007, 03:11:57 pm »
Yes, Just add the $qt4.2/include/Qt* in your compiler path and the corresponding libs for your linker library, RC2 will be OK.

Offline iw2nhl

  • Multiple posting newcomer
  • *
  • Posts: 116
  • BASIC, C, C++, Qt, bash
Re: [Please Help]cant build QT4 application after installation.
« Reply #5 on: January 09, 2007, 04:15:37 pm »
I wonder if the library "QtAssistantClient" exists at all?! The time RC2 came out there was no QT4 yet. And I believe these libs are now named something like "QtAssistantClient4" under Windows.
With regards, Morten.
I just checked in my Qt4 dir and Morten is right: all the Qt4 libs end with "4".

An advice: there is the Qt 4.2.2 version which fixed a lot of bugs. Consider using them!

flobadob

  • Guest
Re: [Please Help]cant build QT4 application after installation.
« Reply #6 on: January 17, 2007, 12:37:36 am »
Yep, the Qt4 version of that library is called -lQtAssistantClient4. I guess the code blocks people need to make separate Qt3 and Qt4 application templates but in the mean time - just edit your .cbp file to reflect the correct library.

tanamo

  • Guest
Re: [Please Help]cant build QT4 application after installation.
« Reply #7 on: January 18, 2007, 04:42:45 am »
I was able to compile the said program by editing the .cbp file, but im getting linking errors when i create a class with signals and slots, what is the solution for this? do i have to create my own .pro file then call qmake? or is it possible to incorporate the moc inside c::b? bec. in visual studio all i have to do is click the icon for creating MOC files, im using Qt 4.2.2,winxp and c::b rc2, i hope there's an easy solution for this, thanks everyone...

Offline iw2nhl

  • Multiple posting newcomer
  • *
  • Posts: 116
  • BASIC, C, C++, Qt, bash
Re: [Please Help]cant build QT4 application after installation.
« Reply #8 on: January 19, 2007, 01:11:25 am »
If the .PRO file created by C::B is correct (does C::B creates a .PRO file?), then you need only to run qmake once to let it create the right makefile for you. Then compile as usual.
Else create the .pro file yourself or use the auto-creation command:
qmake -project
Then continue as described above.

Have you tried the QtWorkbench plugin? (http://forums.codeblocks.org/index.php?topic=2253.0)