[Solved]Compilation error while using libSBML in project
-
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 toSBMLDocument::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 statusPlease let me know if any idea.
Thanks. -
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