OpenCV on ubuntu 11.10
Why don't you use pkg-config to your favor?
g++ hello.c -o hello `pkg-config --cflags --libs opencv`
Strange linker error while compiling OpenCV2.3.1 on Ubuntu 11.10
The problem is that you are attempting to link libopencv_highgui.so
with libavcodec.a
. The latter is built from code compiled without -fPIC
(which is quite usual), and such code can not be linked into shared libraries on x86_64
.
Your choices are:
- Obtain
libavcodec.so
and arrange to link against it, or - Remove
libavcodec
or-lavcodec
from the link line completely.
For the first, you most likely just need to install libavcodec-dev package.
If you do the second, you will still have to arrange for symbols that libopencv_highgui.so
needs from libavcodec
to be available at runtime. You can achieve that by linking the main executable with libavcodec
(either archive or shared variant).
How to build simple OpenCV program
You got a linker error because you didn't specify OpenCV on your GCC command line
Follow that tutorial (http://opencv.willowgarage.com/wiki/CompileOpenCVUsingLinux) link your sample with OpenCV
Related Topics
Opencv Error: Assertion Failed (Size.Width>0 && Size.Height>0) Simple Code
Why Is My Helloworld Function Not Declared in This Scope
Evaluate a String with a Switch in C++
Range Based For-Loop on Array Passed to Non-Main Function
Using Cmake with Multiple Compilers for the Same Language
Behaviour of Malloc with Delete in C++
Winapi Sleep() Function Call Sleeps for Longer Than Expected
Is There a Formula to Determine Overall Color Given Bgr Values? (Opencv and C++)
This Regex Doesn't Work in C++
C/C++: Optimization of Pointers to String Constants
Isdigit(C) - a Char or Int Type
Receiving Chunked Http Data with Winsock
Boost C++ Serialization Overhead
Random Number C++ in Some Range
Accessing Certain Pixel Rgb Value in Opencv
Vector Push_Back Calling Copy_Constructor More Than Once