I wrote a program with openCv libraries and compile it with pkg_config as I mentioned below:
g++ imageproc.cpp -o imageproc pkg-config opencv --cflags --libs
now I must check a flag in my Database for run some functions in my program So I write some query to MySQL server. the problem is that I don't know how I must compile the program. previously I compile programs with query in this way:
gcc funcname.c -o funcname mysql_config --cflags --libs
Can any body help me to compile this program (which has opencv codes and query command)?
Thanks in Advnce.
Related
I can cross compile a simple C++ program. (ex. g++ -o test test.cpp & arm-linux-gnueabihf-g++ -o test test.cpp).
But when I include OpenCV header files in a C++ program and cross compile it, it throws an error.(ex. arm-linux-gnueabihf-g++ -o ocv_test ocv_test.cpp $(pkg-config --libs --cflags opencv)).
Also I can compile successfully with the default compiler i.e. g++.(ex. g++ -o ocv_test ocv_test.cpp $(pkg-config --libs --cflags opencv))
I executed cmake with
-D CMAKE_TOOLCHAIN_FILE=../platforms/linux/arm.toolchain.cmake \.
as per the opencv docs. That didn't help.
I added opencv include dir in compilation cmd ie -I/path/to/opencv/include and removing pkg-config. That didn't help.
I tried changing arm-gnueabi.toolchain.cmake by exporting PKG_CONFIG_LIBDIR as per suggestion by someone. That didn't help.
I got the following error:
__/usr/lib/gcc-cross/arm-linux-gnueabihf/7/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lopencv_shape
//usr/local/lib/libopencv_stitching.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status__
I want my cross-compiled OpenCV app to run on a RaspberryPI.
I'm confused. Cross compiling OpenCV sources with the -D CMAKE_TOOLCHAIN_FILE option should allow us to cross-compile OpenCV C++ programs. Otherwise we will have to cmake or make (cross-compile) every OpenCV C++ program seperately on a build machine.
I can compile the sample continuous.c file by this command inside Ubuntu terminal:
gcc -o continuous continuous.c -DMODELDIR=\"`pkg-config --variable=modeldir pocketsphinx`\" `pkg-config --cflags --libs pocketsphinx sphinxbase`
But if I want to build it inside codeblocks how should I do it?
I want to call gtk+ routines from a C++ program test.cpp, and he encountered a problem while building my program.
I am getting the following error:
g++ test.cpp -o test.x
test.cpp:1:22: fatal error: gtk/gtk.h: No such file or directory
# include <gtk/gtk.h>
Somehow I need to link to gtk+. What will be the correct compiler declarations get my program working.
To compile a program using gtkmm, you need to use the following command:
g++ program.cc -o program `pkg-config --cflags --libs gtkmm-3.0`
The pkg-config --cflags --libs gtkmm-3.0 part provides the include paths and the linker options.
Source: The Flaming Manual, which you should Read.
I'm not sure about gtk in particular but this is a simple file not found issue.
You need to be sure that your system includes search path contains a folder gtk in it which in turn has a file called gtk.h.
Please read about the GCC search paths.
This is also likely a duplicated question so it will probably be closed off soon by the community.
I'm running Ubuntu. I followed each and every step in the http://wiki.allegro.cc for installation and set up of Allegro5. If I run my program from the command line, I know I need to use
gcc -Wall main.cpp `pkg-config --cflags --libs allegro-5.0
plus any other packges I use. (I don't know what all of it means, but I know I need it)
What I need help with if figuring out what I need to do in Codeblocks > Settings > Compiler so that it will link to the allegro library so that I don't get a hundred and one undefined reference errors. I don't know what I'm looking for, and I don't know where to look. Help a new guy out.
Thanks.
edit: I know I'd need
allegro-config --libs --static
in the Linker for Allegro 4.2
Where can I look and what do I need for Allegro5?
If Codeblocks doesn't support entering `pkg-config --cflags --libs allegro-5.0` directly, then just open up a terminal and type in (no backticks):
pkg-config --cflags --libs allegro-5.0
Then copy/paste the result of that into the compiler settings inside Codeblocks.
I have been following this tutorial ( http://note.sonots.com/SciSoftware/haartraining.html ) to do some Haar training. I am currently stuck on merging the generate *.vec files. I am provided with this ( http://note.sonots.com/SciSoftware/haartraining/mergevec.cpp.html ) script and a description of how to build it for Linux, but for Linux only.
I have installed Cygwin, placed mergevec.cpp file into openCV_dir/apps/haartraining and tried to compile it with the following command:
$ g++ 'pkg-config --libs --cflags opencv' -I. -o mergevec mergevec.cpp cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp cvhaartraining.cpp
I recieve following error:
$ g++: error: pkg-config --libs --cflags opencv: No such file or directory
Could someone tell me how should I properly compile it for Windows?
Working on Windows 7, Cygwin x64, OpenCV 2.4.6
I was able to get mergevec.exe from here:
http://note.sonots.com/SciSoftware/haartraining/mergevec.cpp.html
It requires highgui100.dll and cxcore100.dll which I downloaded from:
http://www.dllme.com/