문제

I have this strange error in Qt: LNK1104: cannot open file 'C:\OpenCV246PC\build\x86\vc10\lib.obj'

Settings in Qt are all the same as in VS2010 (where they work fine), but here Qt is complain about the file it can't find even that I see no obvious reference to x86 libraries at all!

Here are my *.pro settings:

#-------------------------------------------------
#
# Project created by QtCreator 2013-07-12T14:50:04
#
#-------------------------------------------------

QT       += core

QT       -= gui

TARGET = myQtConsoleProject
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app


SOURCES += main.cpp


INCLUDEPATH += C:\OpenCV246PC\build\include

LIBS += -LC:\OpenCV246PC\build\x86\vc10\lib \
-lopencv_core246d \
-lopencv_highgui246d \
-lopencv_imgproc246d \
-lopencv_features2d246d \
-lopencv_calib3d246d

And this is simple code I am trying to compile

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

int main ()
{
    // read an image
    cv::Mat image = cv::imread("img.jpg");
    // create image window named "My Image"
    cv::namedWindow("My Image");
    // show the image window
    cv::imshow("My Image", image);
    // wait key for 5000 ms
    cv::waitKey(5000);

    return 1;
}
도움이 되었습니까?

해결책

Problem was resolved by manually adding release build directory:

build-myQtConsoleProject-Desktop_Qt_5_1_0_MSVC2010_32bit-Release

From reasons unknown, probably something with permissions, Qt created debug folder such as: C:\Users\Nenad\Qt\opencv2cookbook\build-myQtConsoleProject-Desktop_Qt_5_1_0_MSVC2010_32bit-Debug

but was unable to do so with: C:\Users\Nenad\Qt\opencv2cookbook\build-myQtConsoleProject-Desktop_Qt_5_1_0_MSVC2010_32bit-Release

Noticed it after I clicked on Projects Build Settings. Path for Release was in red indicating that it can't be found.

Later it happened again. By checking project folder I realize it was set as "read only". Setting this folder's permission definitely resolved this issue.

다른 팁

Similar issue happened to me after I performed the latest Windows 7 critical updates yesterday. The above fix is temporary for me, since upon the 3rd rebuild attempt, it happens again.

I did follow the instructions above and unfortunately I am back to square one.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top