April 30, 2011

ras123 ras123
Ant Farmer
49 posts

Creating and adding a static library

 

Hi,
I am using qt on windows now. I need to add the serial port library (http://code.google.com/p/qextserialport/source/checkout). First I build the library using the CONFIG += staticlib option and get a library with an extension with .a .Now I try to add the library to some example programs given in the event directory. I also add CONFIG += staticlib in the .pro file, but I always get errors like

  1. qextserialport\examples\event-build-desktop/../event/PortListener.cpp:11: undefined reference to `_imp___ZN14QextSerialPort9setParityE10ParityType'

I think there is some linking issues, because it will work when linking with dll files, how to solve?

2 replies

April 30, 2011

ZapB ZapB
Robot Herder
1354 posts

Please post your .pro file for the project that is not linking properly and could you let us know where the statically compiled library is located please?

 Signature 

Nokia Certified Qt Specialist
Interested in hearing about Qt related work

May 1, 2011

ras123 ras123
Ant Farmer
49 posts

Hi,
Here is the complete project code (http://www.4shared.com/file/FFtrqBMR/qextserialport.html ), in which I tried the project in the examples/event folder, i.e

  1. PROJECT = event
  2. TEMPLATE = app
  3. DEPENDPATH += .
  4. INCLUDEPATH += ../../src
  5. QMAKE_LIBDIR += ../../src-build-desktop/build
  6. CONFIG  += staticlib
  7.  
  8. OBJECTS_DIR    = tmp
  9. MOC_DIR        = tmp
  10. UI_DIR         = tmp
  11.  
  12. SOURCES += main.cpp PortListener.cpp
  13. HEADERS += PortListener.h
  14.  
  15. CONFIG(debug, debug|release):LIBS  += -lqextserialportd
  16. else:LIBS  += -lqextserialport

I am using Qt libraries version 4.7.0, Qt Creator IDE version 2.0.1 in Windows
Thanking You,
Ras

 
  ‹‹ USB Communication Using Qt      QExtSerialPort && waitForReadyRead ››

You must log in to post a reply. Not a member yet? Register here!