Question

I am trying to learn Qt, I have file test.cpp that I run via the terminal using the following command:

g++ `pkg-config --cflags --libs libsbml`  test.cpp -L /usr/local/lib -lsbml -lstdc++ -lm

How can I suppl the same options to Qt?

Thank you.

Was it helpful?

Solution

You could write the qmake snippet below. In short, you would need to take a look at the following qmake variables:

LIBS

INCLUDEPATH

TEMPLATE

TARGET

HEADERS

SOURCES

CONFIG

PKGCONFIG

test.pro

TEMPLATE = app
TARGET = test
INCLUDEPATH += .
LIBS += -L /usr/local/lib -lsbml -lstdc++ -lm

unix {
    CONFIG += link_pkgconfig
    PKGCONFIG += libsbml
}

HEADERS += test.h
SOURCES += test.cpp

OTHER TIPS

In .pro file add:

LIBS += -L /usr/local/lib -lsbml -lstdc++ -lm

look at the Makefile to figure out what variables are used. The makefile is in the build folder made by Qt.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top