# Cannot Parse Libraries In Linux Using Qt Enviornment

This post is a wiki. Anyone with karma >50 is welcome to improve it.

After some helpful tips this is the new version of this post, the thing is that it seems my programs is somehow running but it just issues some errors...i don't know what is it actually mentioning, because the libraries are installed, i changed the path form LIBS += -LC:/usr/local/lib/ \ to LIBS += -L/usr/local/lib/ \ as some one said it's actually refering to windows while u r using linux(chakra) and then added "\" at the end of directories and added pkg-config to my .pro file , so this is the new version of a new problem... :

    Starting /home/lucifer/PR0J3CTs/FirstOpenCV-build-desktop-Qt_4_8_2_in_PATH__System__Release/FirstOpenCV...
/home/lucifer/PR0J3CTs/FirstOpenCV-build-desktop-Qt_4_8_2_in_PATH__System__Release/FirstOpenCV exited with code 0

Debugging starts
the debug information found in "/usr/lib/libQtOpenGL.so.4.8.2.debug" does not match "/usr/lib/libQtOpenGL.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtGui.so.4.8.2.debug" does not match "/usr/lib/libQtGui.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtCore.so.4.8.2.debug" does not match "/usr/lib/libQtCore.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtTest.so.4.8.2.debug" does not match "/usr/lib/libQtTest.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtNetwork.so.4.8.2.debug" does not match "/usr/lib/libQtNetwork.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtXml.so.4.8.2.debug" does not match "/usr/lib/libQtXml.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtSvg.so.4.8.2.debug" does not match "/usr/lib/libQtSvg.so.4" (CRC mismatch).
the debug information found in "/usr/lib/libQtDBus.so.4.8.2.debug" does not match "/usr/lib/libQtDBus.so.4" (CRC mismatch).
Debugging has finished


this is my .pro Configurations [ As U can see I've commented (#) one of two LIBS configs, I just wanted to ask which could be more accurate or more helpful, yesterday i tried and it issued some incompatibility with newer version of libavcodec so I googled some and downloaded libavcodec.53 and configured it but I'm uncertain what should happen now , I'm Now at the moment trying to get the opencv-qt-for-all package from ccr community repository and let the program handle these issues by it self, but I'm sure it won't fix my problem] :

QT       += core
QT       -= gui

TARGET = FirstOpenCV
CONFIG   += console
CONFIG   -= app_bundle
PKGCONFIG += opencv

TEMPLATE = app

SOURCES += main.cpp

INCLUDEPATH += /usr/local/include/opencv2/

#LIBS += -L/usr/local/lib/ \
#-libopencv_core.so \
#-libopencv_highgui.so \
#-libopencv_imgproc.so \
#-libopencv_features2d \
#-libopencv_calib3d.so

LIBS += /usr/lib/libopencv_core.so \
/usr/lib/libopencv_highgui.so \
/usr/lib/libopencv_imgproc.so \
/usr/lib/libopencv_features2d.so \
/usr/lib/libopencv_calib3d.so \
/usr/lib/libavcodec.so


And here's The Code :

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace cv;

int main() {

// create image window named "My Image"
namedWindow ...
edit retag close merge delete

Sort by » oldest newest most voted

This post is a wiki. Anyone with karma >50 is welcome to improve it.

If pkg-config is working in your system, an option is to use it and reduce your .pro file to this:

QT       += core
QT       -= gui

TARGET = FirstOpenCV
CONFIG   += console
CONFIG   -= app_bundle
PKGCONFIG += opencv-2.4.2

TEMPLATE = app

SOURCES += main.cpp


This way pkg-config will handle all the paths to libraries and include files for you :) I hope it helps

Oh! And by the way, the problem with your .pro file is that you forgot to add "\" when you break lines:

LIBS += -LC:/usr/local/lib/
-libopencv_core.so.2.4.2
-libopencv_highgui.so.2.4.2
-libopencv_imgproc.so.2.4.2
-libopencv_features2d.so.2.4.2
-libopencv_calib3d.so.2.ss4.2


should be:

LIBS += -LC:/usr/local/lib/ \
-libopencv_core.so.2.4.2 \
-libopencv_highgui.so.2.4.2 \
-libopencv_imgproc.so.2.4.2 \
-libopencv_features2d.so.2.4.2 \
-libopencv_calib3d.so.2.ss4.2

more

After modifying the code like u said , it just turned the "MakeFile Error 3" to "MakeFile Error 2" and it says that the problem occured when executing "Make" step... by the way should i leave the last line "-libopencv_calib3d.so.2.ss4.2" without "\" because the isn't any other line...? i appreciate i u give me the solution.

( 2012-09-27 04:46:35 -0500 )edit

and by the way , when i execute " locate opencv-2.4.2 " there is nothing with this exact name. could that be a problem?

( 2012-09-27 04:47:37 -0500 )edit

And one other thing is it possible that the error is caused by my image? i put it beside the main.cpp in the FirstOpenCV Folder...

( 2012-09-27 04:55:41 -0500 )edit

Could you, please, post the full text of the new errors that you are getting? (It might be a good idea to update your question with the new .pro file and the output generated when trying to build your program). By the way, It is OK to leave the last line without "\".

( 2012-09-27 20:17:35 -0500 )edit

i completely updated the original post, i think it's now more clear and issues more serious problems...tnx

( 2012-09-28 07:00:02 -0500 )edit

Hi! Thanks for updating the original post. But I think you misunderstood my answer. When you use CONFIG += link_pkgconfig PKGCONFIG += opencv-2.4.2 It automatically sets all the variables that you need to use OpenCV. So there is no need for you to define again LIBS. You can delete those lines.

( 2012-09-28 23:13:28 -0500 )edit

This post is a wiki. Anyone with karma >50 is welcome to improve it.

LIBS += -L/usr/local/lib/
-lopencv_core
-lopencv_highgui
-lopencv_imgproc
-lopencv_features2d
-lopencv_calib3d

more

Official site

GitHub

Wiki

Documentation