Ask Your Question
0

Cannot Parse Libraries In Linux Using Qt Enviornment

asked 2012-09-27 03:29:13 -0500

this post is marked as community wiki

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
CONFIG   += link_pkgconfig
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() {

    // read an image
    Mat image = imread("002.jpg");
    // create image window named "My Image"
    namedWindow ...
(more)
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2012-09-27 03:54:56 -0500

this post is marked as community wiki

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
CONFIG   += link_pkgconfig
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
edit flag offensive delete link more

Comments

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.

T0M XeOn LuCiFeR gravatar imageT0M XeOn LuCiFeR ( 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?

T0M XeOn LuCiFeR gravatar imageT0M XeOn LuCiFeR ( 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...

T0M XeOn LuCiFeR gravatar imageT0M XeOn LuCiFeR ( 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 "\".

Martin Peris gravatar imageMartin Peris ( 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

T0M XeOn LuCiFeR gravatar imageT0M XeOn LuCiFeR ( 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.

Martin Peris gravatar imageMartin Peris ( 2012-09-28 23:13:28 -0500 )edit
0

answered 2012-09-27 03:46:47 -0500

this post is marked as community wiki

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

Use -lopencv_core instead of -libopencv_core.so.2.4.2.

LIBS += -L/usr/local/lib/
-lopencv_core
-lopencv_highgui
-lopencv_imgproc
-lopencv_features2d
-lopencv_calib3d
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2012-09-27 03:29:13 -0500

Seen: 858 times

Last updated: Sep 28 '12