Qt install ... Qt nightmare ...

maccatalan

Registered
Hi.

I just installed successfully Qt 3.1.2 on my Mac OS X.2.6

Perfect.

I just compiles successfully a little Qt 'hello world' example ... here's the command to do that :

Code:
c++ -L$QTDIR/lib -I$QTDIR/include -lqt slidenumber.cpp -o SlideNumber

And when I want to execute this newly compiled program here's what I get :

Code:
dyld: /Users/pierre/SlideNumber can't open library: libqt.3.1.2.dylib  (No such file or directory, errno = 2)
Trace/BPT trap

However when I do a ls into the /usr/lib folder I find the requiered library as a symbolic link to the one located into /usr/local/qt/lib
The environment variables ($QTDIR, ...) are good ...

I don't understand what's wrong there. I tryed to restart but still the same error.

Any suggestion ?

Thank you for your help,
Pierre

PS: I also tryed to execute the program into the XFree Server (X11, Apple implementation) and still the same. I say that because I don't know - can't find it into Trolltech documentations - if the Qt/Mac is for X11 or Quartz ...
 
When you ran ./configure to prepare for building Qt, did you specify -shared or -static ?

Try putting the dylib file itself (not symlink) in your home directory or even /usr/lib.
 
Hi. Thank you for the answer.

I set no special argument after the './configure'. I executed it 'as it' with default settings.

I tried to put a copy of the lib file itself intead of a symlink and the result is here : no more message ... but still no one window drawed. The programs executes and then ... nothing. It does not exit, it says nothing ... it does not seem busy ... he is just idle.

Here is the code but I don't think there's any mistake : no errors at compilation time and I copied it from a book ...

I also tried to execute the program into the X11 environment since I don't know who hosts the Qt graphics under Mac OS X : XFree or Quartz ... ? ... confusing thing that the documentation does not answer (so I guess it's Quartz).

Many thx again,
Pierre

Code:
#include <qapplication.h>
#include <qlabel.h>

int main( int argc, char* argv[])
{
   QApplication myapp (argc,argv);
   
   QLabel* myLabel = new QLabel("Hellow, world",0);
   myLabel->resize(120,30);
   myapp.setMainWidget(myLabel);
   myLabel->show();
   return myapp.exec();
}
 
This might help you understand Qt/Mac better: http://www.osnews.com/story.php?news_id=3929
Yes Qt/Mac uses Quartz for UI widgets and does not need X11 at all.

It's an article I wrote last month for OSNews. Your code looks fine, have you tried running or compiling the examples apps in $QTDIR/examples ? Also check Mac HD:Applications:Utilities:Console.app that might show some error messages about your app you're trying to run.
 
that's ok. Now it works! :)

many thx for your help. I compiled it without using the qmake tool. So what I did just know to make it work has been to take the assistant application and to replace the executable (into Contents/MacOS/) by my own compilation. And it worked! :)

Your article is pretty good. :)
However, you could try to look further into Obj-C. It's a really interesting programming language and Cocoa a very powerfull and good API ... May Apple one day release it for others platforms (as NeXT did in the past).

Have fun and many thx,
pierre.
 
Hehe, everyone tells me to "jus give Cocoa a try" and I really have. Although it's taking me a lot longer than I expected to get past the syntax differences, there are some major issues in terms of coding style that I might not be able to grasp, things like making toolbars, inserting items into lists or tables. They're all simple enough tasks but the difference is like night and day compared to the way I'm use to coding.
 
"the wider you see, the better you are"
that's why I am trying Qt ;-)

In fact now I best like Obj-C than C++ even if I continue using C++.
 
True, seeing far and wide is a good thing, but I'm not one to stand still and admire the scenery, I want to go places and keep moving :) To each his own. Happy coding!
 
Back
Top