Results 1 to 4 of 4

Thread: Compilation error when using static ibrary .a file created with QT in Console APP

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2013
    Posts
    2
    Platforms
    Unix/X11 Windows

    Default Re: Compilation error when using static ibrary .a file created with QT in Console APP

    Thanks Toto , it did solve the compilation issue mentioned below.

    However i am facing some more compilation errors while using sbml library .
    I have build libSBML library in Windows 7 machine with MinGW compiler.
    However while using the built library inside my program (console application) i am getting linking errors.

    I have build libSBML statically using below commands:
    1) export CXXFLAGS="-DLIBSBML_STATIC -DLIBLAX_STATIC -I ./dependencies/include
    /xercesc”

    2) ./configure --enable-static --with-xerces=./dependencies --prefix="/home/LABS
    9/outputLibSbml/"

    3) make LDFLAGS=-no-undefined
    //////////////////////////////////main.cpp//////////////////////////
    #include <sbml/SBMLTypes.h>
    #include <sbml/common/extern.h>
    int main(int argc, char *argv[])
    {
    SBMLDocument* document;
    SBMLReader reader;
    return 0;
    }
    ///////////////////////////////////////
    /////////////////////error ////////////////////////////////////////////
    debug/main.o: In function `main':
    D:\QTSamples\TestSBML-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../TestSBML/main.cpp:20: undefined reference to `_imp___ZN10SBMLReaderC1Ev'D:\QTSamples\TestSBML-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../TestSBML/main.cpp:22: undefined reference to `_imp___ZN10SBMLReaderD1Ev'D:\QTSamples\TestSBML-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../TestSBML/main.cpp:22: undefined reference to `_imp___ZN10SBMLReaderD1Ev'collect2: ld returned 1 exit status
    ////////////////////////////////////////////////////////////////////////////////////

    //////////////////TestSBML.pro/////////////////////////////
    TARGET = TestSBML
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    INCLUDEPATH +=../sbmlAll
    LIBS+= -L"../sbmlAll/sbmllib" -lsbml
    /////////////////////////////////////////////////////////////////////////////////////

    Please let me know if any idea.
    Thanks.

    Quote Originally Posted by myta212 View Post
    Hi,
    Are you using windows ?
    if yes,
    please change this line :
    Qt Code:
    1. LIBS+= -L"../MyQTLib-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/debug/libMyQTLib.a"
    To copy to clipboard, switch view to plain text mode 
    to
    Qt Code:
    1. LIBS+= -L"../MyQTLib-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/debug/" -lMyQTLib
    To copy to clipboard, switch view to plain text mode 

    Best regards,

    Toto

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Compilation error when using static ibrary .a file created with QT in Console APP

    That is a linker error. Linker errors are often the result of your LIBS variable being wrong. Either the path associated with the -L option or the name of the library is wrong.

Similar Threads

  1. qvalidator error on static msvc2010 compilation
    By stef13013 in forum Installation and Deployment
    Replies: 0
    Last Post: 19th September 2012, 23:08
  2. Compilation Error , Can't find lib file.
    By vijaydandur in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2011, 05:54
  3. Error in static compilation of Qt 2010.05!
    By elton.lika in forum Newbie
    Replies: 5
    Last Post: 26th January 2011, 21:37
  4. cannot compile QT 4.6 as static - uic3 error stops compilation
    By rucs_hack in forum Installation and Deployment
    Replies: 3
    Last Post: 27th June 2010, 05:35
  5. Replies: 3
    Last Post: 27th December 2008, 19:34

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
  •  
Qt is a trademark of The Qt Company.