[Qt-interest] QTCreator + Addigng static Windows Libraries

John McClurkin jwm at nei.nih.gov
Tue Apr 28 13:32:22 CEST 2009


Parameshwari wrote:
> Sorry for the late reply. Yes, the issue is resolved .
> 
> But, now the problem is : "i am able to link  in incremental way but not
> reverse."
> 
> For example :
>                I can call the external api in Qt. But i am unable to call
> the Qt project  Api's.
> 
> Qt ".pro" file is something like the below :
> 
> 
> QT       += qt3support
> 
> TARGET = link
> TEMPLATE = app
> 
> 
> SOURCES += main.cpp\
>         link.cpp
> 
> HEADERS  += link.h
> 
> FORMS    += link.ui
> 
> INCLUDEPATH = "D:\"
> 
> DEFINES +=  __WINDOWS__
> 
> 
> LIBS+=-ltestlib
> 
> 
> With this, it's able to link correctly. I have  a function called "check()"
> in testlib , i am able to invoke this function. Now i "check function" , i
> am calling another function which is present in qt , which i am not able to.
> 
> For example
> 
> In , link.cpp
> 
> 
> #include "link.h"
> #include "ui_link.h"
> 
> 
> 
> extern "C"
> {
> #include "check.h"
> }

It would be better if you put this C stuff in the check.h header
#ifdef __cplusplus
extern "C" {
#endif




#ifdef __cplusplus
}
#endif

> 
> void testCode()
> {
>     // ...
>     // ...
> }
> 
> link::link(QWidget *parent)
>     : QWidget(parent), ui(new Ui::linkClass)
> {
>     ui->setupUi(this);
>     check();
> 
> }
> 
> link::~link()
> {
>     delete ui;
> }
> 
> 
> 
> In testlib :
> 
> void check(){
>  testCode()
> 
> }
> 
> 
> i am getting the below error :
> 
> undefined refernce to 'testcode()'.  how to get out of this ?
> 
> 
> Thanks &Regards
> Param

What is the order in which you are linking code? You might try linking 
your link.o file twice, once before your testlib.lib and once after.

> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com]On Behalf Of Denton Vis
> Sent: Thursday, April 09, 2009 2:55 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QTCreator + Addign static Windows Libraries
> 
> 
> You have not told us what kind of error message you are getting. Without
> that, we cannot help you much.
> 
> By the way, have you included the header which contains the definitions for
> the functions in the library, e.g. test.h?
> 
> "Parameshwari" <paramr at tataelxsi.co.in> wrote in message
> news:019201c9b8f2$af348160$8519320a at telxsi.com...
>> Hi All,
>>          I wanted to add the static Library to the Qt creator.
>> For example:
>>
>> I have static Library named as "Test.lib" and it has a function definition
>> of "Test()".
>> Now , i want to invoke this function in Qt. how can i do this?.Please help
>> me out!!!!
>>
>> Thanks in advance.
>>
>>
>> Regards
>> param
>>
>>
>>
>> The information contained in this electronic message and any attachments
>> to this message are intended for the exclusive
>> use of the addressee(s) and may contain proprietary, confidential or
>> privileged information. If you are not the intended
>> recipient, you should not disseminate, distribute or copy this e-mail.
>> Please notify the sender immediately and destroy
>> all copies of this message and any attachments contained in it.
>>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



More information about the Qt-interest-old mailing list