Reputation: 5444
I am running and compiling my c++ code using linux terminal gcc commands. I want to compile and run the code from qt. I am struggling to understand the dependencies I have to convert from console command to qt dependencies in .pro file. Console command for compiling the project is the following:
g++ `pkg-config --cflags opencv` -c -g -MMD -MP -MF main.o.d -o main.o main.cpp
gcc -c -g `pkg-config --cflags opencv` -MMD -MP -MF svmlight/svm_learn.o.d -o svmlight/svm_learn.o svmlight/svm_learn.c
gcc -c -g `pkg-config --cflags opencv` -MMD -MP -MF svmlight/svm_hideo.o.d -o svmlight/svm_hideo.o svmlight/svm_hideo.c
gcc -c -g `pkg-config --cflags opencv` -MMD -MP -MF svmlight/svm_common.o.d -o svmlight/svm_common.o svmlight/svm_common.c
g++ `pkg-config --cflags opencv` -o trainhog main.o svmlight/svm_learn.o svmlight/svm_hideo.o svmlight/svm_common.o `pkg-config --libs opencv`
The created .pro file in qt is the following:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
How can I add those dependencies from console command to qt .pro file? I tried to compile my project with the following *.pro file:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
INCLUDEPATH += /usr/local/include/
INCLUDEPATH += /usr/local/include/opencv
INCLUDEPATH += /usr/local/include/opencv2
INCLUDEPATH += path/svmlight/
LIBS += -L/usr/local/lib
LIBS += -lopencv_core
//I add all necessary opencv libs
However I am getting several undefined references for 'my_malloc' 'verbosity' 'free model'... main.cpp:-1: error: undefined reference to `my_malloc'
main.o:-1: In function `SVMlight::~SVMlight()':
(.text._ZN8SVMlightD2Ev[_ZN8SVMlightD5Ev]+0x15):-1: error: undefined reference to `kernel_cache_cleanup'
(.text._ZN8SVMlightD2Ev[_ZN8SVMlightD5Ev]+0x29):-1: error: undefined reference to `free_model'
(.text._ZN8SVMlightD2Ev[_ZN8SVMlightD5Ev]+0x4e):-1: error: undefined reference to `free_example'
(.text._ZN8SVMlightD0Ev[_ZN8SVMlightD5Ev]+0x15):-1: error: undefined reference to `kernel_cache_cleanup'
(.text._ZN8SVMlightD0Ev[_ZN8SVMlightD5Ev]+0x29):-1: error: undefined reference to `free_model'
(.text._ZN8SVMlightD0Ev[_ZN8SVMlightD5Ev]+0x4e):-1: error: undefined reference to `free_example'
(.text._ZN8SVMlightD0Ev[_ZN8SVMlightD5Ev]+0x4e):-1: error: undefined reference to `free_example'
Upvotes: 0
Views: 413
Reputation: 3854
You can find a list of available commands for *.pro
files here.
For your purpose you should look at INCLUDEPATH
, LIBS
and probably some of the FLAG
keywords.
The errors you are getting seem to belong to the svmlight
Lib. From what you show from your pro-file you have only included LIBS
that belong to opencv
, not those of svmlight
Upvotes: 1