Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    [Solved]Compilation error while using libSBML in project

    Installation and Deployment
    2
    3
    759
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      Klayman last edited by

      Hello everyone!

      I have build libSBML statically , so there are three files in my lib folder: libsbml.a, libsbml.dll.a and libsbml.la

      My .pro file:

      @INCLUDEPATH += C:/libsbml-5.10.2/libsbml/include
      LIBPATH += C:/libsbml-5.10.2/libsbml/lib
      LIBS += -lsbml@

      When I'm trying to run this code:

      @SBMLDocument* document = readSBML(argv[1]);

      unsigned int errors = document->getNumErrors();
      cout << endl;
      cout << " filename: " << argv[1] << endl;
      cout << " error(s): " << errors << endl;
      cout << endl;
      if (errors > 0) document->printErrors(cerr);@

      so get some errors, like this:

      ./debug\main.o: In function Z5qMainiPPc': C:\Users\Klayman\Desktop\build-3dCube-Desktop_Qt_5_3_MinGW_32bit-Debug/../3dCube/main.cpp:62: undefined reference to readSBML'
      C:\Users\Klayman\Desktop\build-3dCube-Desktop_Qt_5_3_MinGW_32bit-Debug/../3dCube/main.cpp:64: undefined reference to SBMLDocument::getNumErrors() const' C:\Users\Klayman\Desktop\build-3dCube-Desktop_Qt_5_3_MinGW_32bit-Debug/../3dCube/main.cpp:69: undefined reference to SBMLDocument::printErrors(std::ostream&) const'
      collect2.exe: error: ld returned 1 exit status

      Please let me know if any idea.
      Thanks.

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Sounds like the library is not found, it should rather be

        @
        LIBS += -LC:/libsbml-5.10.2/libsbml/lib
        LIBS += -lsbml
        @

        Hope it helps

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • K
          Klayman last edited by

          Thank you! I found that I built library in wrong way...

          1 Reply Last reply Reply Quote 0
          • First post
            Last post