Ask Your Question
0

qt 5.7, opencv 3.1 and win 10

asked 2017-02-10 01:23:45 -0600

vics gravatar image

hi

using MinGW and Cmake I built opencv (with Qt option) and now trying ro run sample program.

Here is the code

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

int main()
{
    cv::Mat image= cv::imread("C:\\Work\\QT\\test_project\\1.jpg");
        cv::namedWindow("My Image");
        cv::imshow("My Image", image);
        cv::waitKey(50000);
        return 1;
}

PRO FILE

QT       += core
QT       -= gui
TARGET = test_project
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

INCLUDEPATH += "C:\Work\Libs\output\openCV\release\include" \
                   "C:\Work\Libs\output\openCV\release\include/opencv" \
                   "C:\Work\Libs\output\openCV\release\include/opencv2"

LIBS += -LC:\Work\Libs\output\openCV\release\x86\mingw\lib \
    -llibopencv_imgcodecs310.dll.a \
    -lopencv_core310.dll.a \
    -lopencv_highgui310.dll.a \
    -lopencv_imgproc310.dll.a \
    -lopencv_features2d310.dll.a \
    -lopencv_calib3d310.dll.a \

i've got 6 errors, like that : cannot find -lopencv_imgcodecs310.dll.a and others libs. All files are situate in

C:\Work\Libs\output\openCV\release\x86\mingw\lib

10.02.2017  10:14    <DIR>          .
10.02.2017  10:14    <DIR>          ..
10.02.2017  10:14                 0 1.txt
09.02.2017  16:07           487 256 libopencv_calib3d310.dll.a
09.02.2017  15:44         1 562 944 libopencv_core310.dll.a
09.02.2017  16:05           521 730 libopencv_features2d310.dll.a
09.02.2017  15:53           380 780 libopencv_flann310.dll.a
09.02.2017  15:49           410 224 libopencv_highgui310.dll.a
09.02.2017  15:48           361 288 libopencv_imgcodecs310.dll.a
09.02.2017  15:47           579 740 libopencv_imgproc310.dll.a
09.02.2017  15:58           388 912 libopencv_ml310.dll.a
09.02.2017  16:02           419 682 libopencv_objdetect310.dll.a
09.02.2017  15:59           462 138 libopencv_photo310.dll.a
09.02.2017  16:01           374 498 libopencv_shape310.dll.a
09.02.2017  16:09           805 528 libopencv_stitching310.dll.a
09.02.2017  16:03           478 608 libopencv_superres310.dll.a
09.02.2017  16:00           375 726 libopencv_video310.dll.a
09.02.2017  15:49           390 076 libopencv_videoio310.dll.a
09.02.2017  16:10           643 104 libopencv_videostab310.dll.a
09.02.2017  15:25            16 517 OpenCVConfig.cmake
09.02.2017  15:38            12 525 OpenCVModules-release.cmake
09.02.2017  15:30             4 763 OpenCVModules.cmake

The my Path system variable holds the following

;C:\MinGW\bin;C:\Work\Libs\output\zlib\lib;C:\Work\Libs\output\jpeg\lib;C:\Work\Libs\output\geotiff\lib;C:\Work\Libs\output\proj\lib;C:\Work\Libs\output\tiff\lib;C:\Work\Libs\output\gdal\lib;C:\Qt\Qt5.7.1\Tools\QtCreator\bin;C:\Work\Libs\output\openCV\release\x86\mingw\lib;

how to fix that ?

Thanks at advance

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
1

answered 2019-04-24 09:31:43 -0600

Ejok gravatar image

Try the next variant:

LIBS += -LC:\Work\Libs\output\openCV\release\x86\mingw\lib \
-lopencv_imgcodecs310 \
-lopencv_core310 \
-lopencv_highgui310 \
-lopencv_imgproc310 \
-lopencv_features2d310 \
-lopencv_calib3d310 \

-l prefix takes away the need to write lib* prefix and *.dll.a suffix

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-10 01:23:45 -0600

Seen: 877 times

Last updated: Apr 24 '19