I'm trying to build opencv source using sublime text 2 but it seems that there is problem in linking opencv libraries using pkg-config
My C++.sublime-build
{
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "g++ -ggdb '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}' `pkg-config --cflags --libs opencv`"]
}
]
}
PS: When I try to compile my program from terminal with this compilation is successful.
g++ -ggdb source.cpp `pkg-config --cflags --libs opencv`
I might be too late, but I suppose you should swap pkg-config --cflags --libs opencv
and
&& '${file_path}/${file_base_name}''s position, since pkg-config
part is used in compilation, and the && '${file_path}/${file_base_name}' part seems to be the execution part.
"cmd": ["bash", "-c", "g++ -ggdb '${file}' -o '${file_path}/${file_base_name}' pkg-config --cflags --libs opencv
&& '${file_path}/${file_base_name}' "]
If you're interested, I've created my own build system of it here: http://subokita.com/2013/04/21/configuring-sublime-to-work-with-opencv-on-mac/