[Qt-creator] How to include libraries in Qt

Ladnar, Marc Marc.Ladnar at ksab.kroschu.com
Mon Feb 15 07:12:04 CET 2010


Hi Krishna,
 
did you include
 
LIBS +=
-L\S60\devices\S60_5th_Edition_SDK_v1.0\epoc32\release\armv5\LIB\
 
 in the .pro file? The compiler needs to know where to find the lib you
want to link.
The line with LIBS += -lMyDLL.dll is O.K.
 
Regards,
 
Marc Ladnar

  _____  

Von: Krishna Achugatla [mailto:krishnaa at symbian.org] 
Gesendet: Samstag, 13. Februar 2010 02:23
An: qt-creator at trolltech.com
Betreff: Re: [Qt-creator] How to include libraries in Qt



Hi Mark, Thanks. Still no luck, here I am explaining in detail. 

Hi,

My objective is to create a shared library and link it with app and call
some APIs of dll in the app. 

Platform Details:
-----------------------
Qt for Symbian 4.6.0
Qt Creator 1.3.0
S60 5th edition
Abld is build system

Below are the steps followed and issued faced.

1. Creating "App"
   I created an app called "MyApp" using Qt-Creator "Qt4 Gui
Application" option. Default tool chain used to build is GCCE and able
to build it.

2. Creating "Shared Library"
   I created a shared library called "MyDLL" using Qt-Creator option
"C++ Library" then "Shared Library". Default tool chain is GCCE and able
to built it.

3. Link "Shared Library" with "App"
   I don't find any good documentation of how to do this, the whole
sequence of steps needed. I figured that LIBS needs.

   Added below line to MyApp.pro file
   LIBS    += -lMyDLL.dll
   
   as suggested by qmake help, then building the app gives error

make[2]: *** No rule to make target
`\S60\devices\S60_5th_Edition_SDK_v1.0\epoc32\release\armv5\LIB\MyDLL.ds
o', needed by
`\S60\devices\S60_5th_Edition_SDK_v1.0\epoc32\release\gcce\udeb\MyApp.ex
e'. Stop.
make[1]: *** [TARGETMYAPP_0XE25A8EF2] Error 2

Question is : I am working with tool chain GCCE, why make is looking
into ARMV5 path?. i.e.
`\S60\devices\S60_5th_Edition_SDK_v1.0\epoc32\release\armv5\LIB\MyDLL.ds
o

4. Trying to work with Tool chain ARMV5
   First, I want to build the MyDLL with Armv5. I created a new project
settings with tool chain as ARMV5, then build MyDLL. Following error
occrued

   Error: C0000U: Unrecognized option '--visibility_inlines_hidden'.
make[2]: ***
[\S60\devices\S60_5th_Edition_SDK_v1.0\EPOC32\BUILD\Qt-Projects\DLL\MyDL
L\MYDLL_0XE11197E8\ARMV5\udeb\mydll.o] Error 1
make[1]: *** [TARGETMYDLL_0XE11197E8] Error 2

  The generated MyDLL_0xE11197e8.mmp file has the line
  OPTION ARMCC --visibility_inlines_hidden --fpu softvfp


I feel, creating a library is a very basic thing and it should be very
easy for any body to do. There should be a single wiki page explaining
all the steps with code whereever possible.

I feel we should have detailed docmentation for Static Library, Shared
Library and Plugins with code examples.

Let me know if I miss any thing...

-Krishna.


On 11 February 2010 22:40, Ladnar, Marc <Marc.Ladnar at ksab.kroschu.com>
wrote:


   Hi Krishna, 
   
   ther is no difference in binding your static or dynamic library into
   another app. 
   You just have to put this line into your app.pro file: 
   LIBS += -L[PATH_TO_YOUR_LIB] -l[LIB_NAME] 
   If your lib is called libxy, you will have to add -lxy, so leave the
   part "lib". 
   Static libs are directly included into the binary, dynamic libs have
   to be delivered with the app. 
   
   Adding Plugins into your app needs the QPluginLoader, it is
   documented in QtAssistant. Plugins have to be delivered with the app,
   too. 
   
   Hope I could help, have a nice day. 
   
   Marc Ladnar 

  _____  

      Von: Krishna Achugatla [mailto:krishnaa at symbian.org] 
   Gesendet: Freitag, 12. Februar 2010 00:24
   An: Qt-creator at trolltech.com
   Betreff: [Qt-creator] How to include libraries in Qt
   
   

   Hi, 


   I have created a Qt SharedLibrary (e.g. MySharedLibrary) using
   Qt-Creator. I followed the navigation steps "File"->"New File or
   Project->Projects"->"C++ Library". Then choose the "Type" as "Shared
   Library", gave name and it created the Shared Library. The created
   shared lib has the necessary declarations and defines wrt
   Q_DECL_EXPORT. I wrote few functions in that class, so that they can
   be accessed in another application. 

   How do I include this Shared Library as part of another Qt
   Application?. What are the necessary changes required to make to .pro
   file (like adding LIBS variable) and source files of the app?. Please
   let me know any documentation is available. If the documentation
   explains with code, the necessary changes then it becomes very easy
   for developers. 

   Similarly it is good to have documentation about other two types of
   libraries, viz. "Statically linked library" & "Plugin", how to
   include them in an application with example code. 

   -Krishna. 

   


   _______________________________________________
   Qt-creator mailing list
   Qt-creator at trolltech.com
   http://lists.trolltech.com/mailman/listinfo/qt-creator
   
   



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-creator-old/attachments/20100215/8c6b0145/attachment.html 


More information about the Qt-creator-old mailing list