Dependent static library depends on Qt ....

General questions regarding the usage of CodeLite
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Dependent static library depends on Qt ....

Post by jiapei100 »

Hi...

I found a problem, could be a bug.


My project "son" is a QT based project, which relies on "father" (which is also a QT based project )
(Yes, as you might have guessed out, I'd love "son" inherit some .ui-built-classes of "father" .

Then, I built "father" into a static library, we may call it "libfather.a" .

When I tried to build "son", it could be a bug that the linked library sequence are like

Code: Select all

"-L/usr/lib -L../father/Debug -lfather -lQtGui -lQtCore -lpthread "
Here comes the problem because "libfather.a" is a static library, which depends on "QtGui", "QtCore", and "pthread" as well.
So, there might be a library link sequence problem here.

Can you please ensure those "system libraries" are linked first, at the very very beginning of the library link sequence???
Say,

Code: Select all

 "-L/usr/lib -L../father/Debug -lQtGui -lQtCore -lpthread -lfather"
But, I'm not quite sure whether this could be a problem or not. I just guessed so.

The error messages I obtained are something like:

Code: Select all

undefined reference to `....'

Finally, if I changed "father" form static library to an executable project, I can run "father" correctly, with Qt GUI displayed perfectly.

So, any suggestions?

Best Regards
JIA
Welcome to Vision Open
http://www.visionopen.com
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Re: Dependent static library depends on Qt ....

Post by jiapei100 »

Yes, i found the problem seems to be "recursive dependencies".

Say, project "A" depends on "B", which depends on "C".
Depicted as

Code: Select all

A<-B<-C 
A is executable project, while B and C are static libraries.

Whenever I tried to build A, I obtained something like

Code: Select all

undefined reference to `C::C()'
which seems to tell, the constructor and destructor of C are missing !!!!!!

This seems to tell that "CodeLite" IDE put the link sequence as
B first, C second, which makes B unlinkable. The link sequence should be C first, B second.
Well, I just guess so. How to ensure the dependent libraries are linked first?


Any suggestions please? Is it possible this is a current bug of CodeLite?

Best Regards
JIA
Welcome to Vision Open
http://www.visionopen.com
jiapei100
CodeLite Expert
Posts: 115
Joined: Wed Dec 30, 2009 8:29 am
Genuine User: Yes
IDE Question: C++
Location: Surrey, BC, Canada
Contact:

Re: Dependent static library depends on Qt ....

Post by jiapei100 »

Sorry, it is my fault.

If A depends on B, which depends on C.
The link sequence must be:

B first, then C

Sorry for my stupid question.

Best Regards
JIA
Welcome to Vision Open
http://www.visionopen.com
Post Reply