# Revision history [back]

### How do I use opencv.pc 2.4.1

Normally I would know to use

pkg-config --libs opencv


as part of my linker command (ok, properties in NetBeans). However, I can't seem to get it to work.

The symptom of it not working is a laundry list of link-time errors that looks like:

/usr/local/include/opencv2/core/core_c.h:134: undefined reference to cvFree_'
/usr/local/include/opencv2/core/core_c.h:142: undefined reference to cvFree_'
build/Debug/GNU-Linux-x86/_ext/602031749/usingOpenCV.o: In function cvGetRow':
/usr/local/include/opencv2/core/core_c.h:184: undefined reference to cvGetRows'
build/Debug/GNU-Linux-x86/_ext/602031749/usingOpenCV.o: In function cvGetCol':
/usr/local/include/opencv2/core/core_c.h:195: undefined reference to cvGetCols'


From what I read the opencv.pc file produced when i built opencv following these instructions, is broken or non-standard.

1. *Is this correct? Is there a fix/patch? With instructions on how to apply it? *
2. Does anyone have an opencv.pc file that returns the usual -l nad -L type entries rather than the list of .so's.
3. Are there other tags i should add to this question? I am not familiar enogh with opencv to know which to select for it.

Example:

$pkg-config --libs opencv /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local /lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local /lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so  I was really expecting something that looked like -L/usr/local/lib -lopencv-core .... I tried coding the -l's by hand in my NetBeans linker command, but that fails also. :-( -o${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/autostart -L/opt/voyant/lib -L/usr/local/lib
-lvoyant -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu
-lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree
-lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_video
-lopencv_videostab pkg-config --libs opencv


### How do I use opencv.pc 2.4.1

Normally I would know to use

pkg-config --libs opencv


as part of my linker command (ok, properties in NetBeans). However, I can't seem to get it to work.

The symptom of it not working is a laundry list of link-time errors that looks like:

/usr/local/include/opencv2/core/core_c.h:134: undefined reference to cvFree_'
/usr/local/include/opencv2/core/core_c.h:142: undefined reference to cvFree_'
build/Debug/GNU-Linux-x86/_ext/602031749/usingOpenCV.o: In function cvGetRow':
/usr/local/include/opencv2/core/core_c.h:184: undefined reference to cvGetRows'
build/Debug/GNU-Linux-x86/_ext/602031749/usingOpenCV.o: In function cvGetCol':
/usr/local/include/opencv2/core/core_c.h:195: undefined reference to cvGetCols'


From what I read the opencv.pc file produced when i built opencv following these instructions, is broken or non-standard.

1. *Is this correct? Is there a fix/patch? With instructions on how to apply it? *
2. Does anyone have an opencv.pc file that returns the usual -l nad -L type entries rather than the list of .so's.
3. Are there other tags i should add to this question? I am not familiar enogh with opencv to know which to select for it.

Example:

$pkg-config --libs opencv /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local /lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local /lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so  I was really expecting something that looked like -L/usr/local/lib -lopencv-core .... I tried coding the -l's by hand in my NetBeans linker command, but that fails also. :-( -o${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/autostart -L/opt/voyant/lib -L/usr/local/lib
-lvoyant -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu
-lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree
-lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_video
-lopencv_videostab pkg-config --libs opencv


and I tried both gcc and g++. Same errors, different progress messages.

### How do I use opencv.pc 2.4.1

Normally I would know to use

pkg-config --libs opencv


as part of my linker command (ok, properties in NetBeans). However, I can't seem to get it to work.

The symptom of it not working is a laundry list of link-time errors that looks like:

/usr/local/include/opencv2/core/core_c.h:134: undefined reference to cvFree_'
/usr/local/include/opencv2/core/core_c.h:142: undefined reference to cvFree_'
build/Debug/GNU-Linux-x86/_ext/602031749/usingOpenCV.o: In function cvGetRow':
/usr/local/include/opencv2/core/core_c.h:184: undefined reference to cvGetRows'
build/Debug/GNU-Linux-x86/_ext/602031749/usingOpenCV.o: In function cvGetCol':
/usr/local/include/opencv2/core/core_c.h:195: undefined reference to cvGetCols'


From what I read the opencv.pc file produced when i built opencv following these instructions, is broken or non-standard.

1. *Is this correct? Is there a fix/patch? With instructions on how to apply it? *
2. Does anyone have an opencv.pc file that returns the usual -l nad -L type entries rather than the list of .so's.
3. Are there other tags i should add to this question? I am not familiar enogh with opencv to know which to select for it.

Example:

$pkg-config --libs opencv /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local /lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local /lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so  I was really expecting something that looked like -L/usr/local/lib -lopencv-core .... I tried coding the -l's by hand in my NetBeans linker command, but that fails also. :-( -o${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/autostart -L/opt/voyant/lib -L/usr/local/lib
-lvoyant -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu
-lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree
-lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_video
-lopencv_videostab pkg-config --libs opencv


and I tried both gcc and g++. Same errors, different progress messages.