Results 1 to 5 of 5

Thread: QT and my own shared library, undefined reference to ...

  1. #1
    Join Date
    May 2008
    Location
    Spain
    Posts
    90
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QT and my own shared library, undefined reference to ...

    Hello,

    I have my own shared library and when I compile my C application with flag -lLEICAN (it is my library), there is not problem.

    Now I have a QT application, and here there is a problem.
    I have compiled QT application with the same flags, but g++ return me a error:

    mydialog.cpp.text+0x3d1): undefined reference to........

    Any advice???

    Best regards.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QT and my own shared library, undefined reference to ...

    You managed to cut the interesting part out of the error message. Could you paste the .pro file, linker command and the complete error?
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    webquinty (4th March 2009)

  4. #3
    Join Date
    May 2008
    Location
    Spain
    Posts
    90
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QT and my own shared library, undefined reference to ...

    OK!!!

    app.pro
    TEMPLATE = app
    INCLUDEPATH += .

    # Input
    HEADERS += global.h mydialog.h mydialog.ui.h taskman.h touchpad.h touchpad.ui.h
    SOURCES += main.cpp mydialog.cpp taskman.c touchpad.cpp
    Output of compiler
    john@Linux-D530:~/workspace/RT_QT_v0.2> make
    g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o main.o main.cpp

    g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o mydialog.o mydialog.cpp

    gcc -c -pipe -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o taskman.o taskman.c

    g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o touchpad.o touchpad.cpp
    In file included from touchpad.cpp:24:
    /home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include/qwindowsystem_qws.h:211: warning: ‘typedef’ was ignored in this declaration
    /home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include/qwindowsystem_qws.h:216: warning: ‘typedef’ was ignored in this declaration
    /home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/bin/moc mydialog.h -o moc_mydialog.cpp

    g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o moc_mydialog.o moc_mydialog.cpp
    /home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/bin/moc touchpad.h -o moc_touchpad.cpp

    g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -m32 -mtune=geode -O2 -DQT_NO_DEBUG -DQT_SHARED -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/mkspecs/default -I. -I. -I/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/include -o moc_touchpad.o moc_touchpad.cpp

    g++ -m32 -mtune=geode -Wl,-rpath,/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/lib -o RT_QT_v0.2 main.o mydialog.o taskman.o touchpad.o moc_mydialog.o moc_touchpad.o -L/home/john/GeodeProject/Qt-embedded/qt-embedded-free-3.3.6/lib -lqte -lrt -lLEICIF -lpthread

    mydialog.o: In function `MyDialog::CanActivate()':
    mydialog.cpp.text+0x48a): undefined reference to `LEICANstop(int)'
    collect2: ld returned 1 exit status
    make: *** [RT_QT_v0.2] Error 1
    In taskman.c there is other LEICANstop() function but in this case there is not problem.
    In both files, taskman.c and mydialog.cpp there is a inlcude for lib, libLEICIF.h

    Thank you
    Last edited by webquinty; 4th March 2009 at 13:46.

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QT and my own shared library, undefined reference to ...

    J-P Nurmi

  6. The following user says thank you to jpn for this useful post:

    webquinty (4th March 2009)

  7. #5
    Join Date
    May 2008
    Location
    Spain
    Posts
    90
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QT and my own shared library, undefined reference to ...

    Thank you, I am going to read this document.

    Best regards

Similar Threads

  1. Unable to install QT 4.4.0 from sources
    By debnathm in forum Installation and Deployment
    Replies: 4
    Last Post: 6th August 2008, 06:43
  2. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  3. MS Sql native driver??
    By LordQt in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2007, 13:41
  4. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 14:28
  5. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.