Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

after reboot undefined reference to `cv::imread(std::string const&, int)'

I have Qt 5.3 on Windows x64

Compiled opencv with cmake - both release and debug versions

PATH

c:\Dev\OpenCV-2.4.9-android-sdk\sdk\native\libs\armeabi-v7a\;c:\Dev\opencv\debug\install\x64\mingw\bin\;c:\Dev\opencv\release\install\x64\mingw\bin\;C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;C:\Dev\CMake\bin;

.pro project file has only these lines:

INCLUDEPATH += C:\\Dev\\opencv\\release\\install\\include
LIBS += -LC:\\Dev\\opencv\\release\\install\\x64\\mingw\\bin\\*.*

main.cpp simple test example

#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 on window
        cv::imshow("My Image", image);
        // wait key for 5000 ms
        cv::waitKey(5000);
        return 1;
}

This example was running. Now when I try to do the same after reboot - getting these results: C:\workspace\untitled7\main.cpp:9: error: undefined reference to `cv::imread(std::string const&, int)'

No clue at all what should be done. Apparently it doesn't link, but why it did in first run? Exactly the same result I'm getting in linux environment. Why?

after reboot undefined reference to `cv::imread(std::string const&, int)'

I have Qt 5.3 on Windows x64

Compiled opencv with cmake - both release and debug versions

PATH

c:\Dev\OpenCV-2.4.9-android-sdk\sdk\native\libs\armeabi-v7a\;c:\Dev\opencv\debug\install\x64\mingw\bin\;c:\Dev\opencv\release\install\x64\mingw\bin\;C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;C:\Dev\CMake\bin;
c:\Dev\opencv\debug\install\x64\mingw\bin\;
c:\Dev\opencv\release\install\x64\mingw\bin\;
C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;
C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;
C:\Dev\CMake\bin;

.pro project file has only these lines:

INCLUDEPATH += C:\\Dev\\opencv\\release\\install\\include
LIBS += -LC:\\Dev\\opencv\\release\\install\\x64\\mingw\\bin\\*.*

main.cpp simple test example

#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 on window
        cv::imshow("My Image", image);
        // wait key for 5000 ms
        cv::waitKey(5000);
        return 1;
}

This example was running. Now when I try to do the same after reboot - getting these results: C:\workspace\untitled7\main.cpp:9: error: undefined reference to `cv::imread(std::string const&, int)'

No clue at all what should be done. Apparently it doesn't link, but why it did in first run? Exactly the same result I'm getting in linux environment. Why?

after reboot undefined reference to `cv::imread(std::string const&, int)'

I have Qt 5.3 on Windows x64

Compiled opencv with cmake - both release and debug versions

PATH

c:\Dev\opencv\debug\install\x64\mingw\bin\;
c:\Dev\opencv\release\install\x64\mingw\bin\;
C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;
C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;
C:\Dev\CMake\bin;

.pro project file has only these lines:lines added:

INCLUDEPATH += C:\\Dev\\opencv\\release\\install\\include
LIBS += -LC:\\Dev\\opencv\\release\\install\\x64\\mingw\\bin\\*.*

main.cpp simple test example

#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 on window
        cv::imshow("My Image", image);
        // wait key for 5000 ms
        cv::waitKey(5000);
        return 1;
}

This example was running. Now when I try to do the same after reboot - getting these results: C:\workspace\untitled7\main.cpp:9: error: undefined reference to `cv::imread(std::string const&, int)'

No clue at all what should be done. Apparently it doesn't link, but why it did in first run? Exactly the same result I'm getting in linux environment. Why?

after reboot undefined reference to `cv::imread(std::string const&, int)'

I have Qt 5.3 5.3.0 for Android (Windows 32-bit, 813 MB) on Windows x64

Compiled opencv with cmake - both release and debug versions

PATH

c:\Dev\opencv\debug\install\x64\mingw\bin\;
c:\Dev\opencv\release\install\x64\mingw\bin\;
C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;
C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;
C:\Dev\CMake\bin;

.pro project file has only these lines added:

INCLUDEPATH += C:\\Dev\\opencv\\release\\install\\include
LIBS += -LC:\\Dev\\opencv\\release\\install\\x64\\mingw\\bin\\*.*

main.cpp simple test example

#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 on window
        cv::imshow("My Image", image);
        // wait key for 5000 ms
        cv::waitKey(5000);
        return 1;
}

This example was running. Now when I try to do the same after reboot - getting these results: C:\workspace\untitled7\main.cpp:9: error: undefined reference to `cv::imread(std::string const&, int)'

No clue at all what should be done. Apparently it doesn't link, but why it did in first run? Exactly the same result I'm getting in linux environment. Why?

after reboot undefined reference to `cv::imread(std::string const&, int)'

I have Qt 5.3.0 for Android (Windows 32-bit, 813 MB) on Windows x64

Compiled opencv with cmake - both release and debug versions

PATH

c:\Dev\opencv\debug\install\x64\mingw\bin\;
c:\Dev\opencv\release\install\x64\mingw\bin\;
C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;
C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;
C:\Dev\CMake\bin;

.pro project file has only these lines added:

INCLUDEPATH += C:\\Dev\\opencv\\release\\install\\include
LIBS += -LC:\\Dev\\opencv\\release\\install\\x64\\mingw\\bin\\*.*

main.cpp simple test example

#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 on window
        cv::imshow("My Image", image);
        // wait key for 5000 ms
        cv::waitKey(5000);
        return 1;
}

This example was running. Now when I try to do the same after reboot - getting these results: C:\workspace\untitled7\main.cpp:9: error: undefined reference to `cv::imread(std::string const&, int)'

No clue at all what should be done. Apparently it doesn't link, but why it did in first run? Exactly the same result I'm getting in linux environment. Why?

I ended up with just adding libraries in this manner(different project, but tested and it worked for this example):

win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_core249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_highgui249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_imgproc249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_features2d249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_calib3d249.dll.a

No idea why it was working with initial settings. It was fresh System with new Qt install and compiled opencv. Since there has been many similar posts and none of themm have explained, that libraries can be linked to a .dll.a files, let' s hope that it will help other, who has similar Qt setup problems.

Also I'm curious why opencv is not shipping with prebuilt Qt libraries - it is not rare C/C++ tool and probably by now as widespread as Visual Studio. I was using Visual Studio for years and moved(run away) to Qt, because it offered the same - GUI without the need to delve into configuration of command lines and also possibility to use it on multiple operational systems. Visual Studio is just bound with one - MS and hardly opencv can be called open if it is so bound to MS.

I think, I've found answer. It was really lib directory, not bin, so it is answered.

after reboot undefined reference to `cv::imread(std::string const&, int)'

I have Qt 5.3.0 for Android (Windows 32-bit, 813 MB) on Windows x64

Compiled opencv with cmake - both release and debug versions

PATH

c:\Dev\opencv\debug\install\x64\mingw\bin\;
c:\Dev\opencv\release\install\x64\mingw\bin\;
C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;
C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;
C:\Dev\CMake\bin;

.pro project file has only these lines added:

INCLUDEPATH += C:\\Dev\\opencv\\release\\install\\include
LIBS += -LC:\\Dev\\opencv\\release\\install\\x64\\mingw\\bin\\*.*

main.cpp simple test example

#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 on window
        cv::imshow("My Image", image);
        // wait key for 5000 ms
        cv::waitKey(5000);
        return 1;
}

This example was running. Now when I try to do the same after reboot - getting these results: C:\workspace\untitled7\main.cpp:9: error: undefined reference to `cv::imread(std::string const&, int)'

No clue at all what should be done. Apparently it doesn't link, but why it did in first run? Exactly the same result I'm getting in linux environment. Why?

I ended up with just adding libraries in this manner(different project, but tested and it worked for this example):

win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_core249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_highgui249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_imgproc249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_features2d249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_calib3d249.dll.a

No idea why it was working with initial settings. It was fresh System with new Qt install and compiled opencv. Since there has been many similar posts and none of themm have explained, that libraries can be linked to a .dll.a files, let' s hope that it will help other, who has similar Qt setup problems.

Also I'm curious why opencv is not shipping with prebuilt Qt libraries - it is not rare C/C++ tool and probably by now as widespread as Visual Studio. I was using Visual Studio for years and moved(run away) to Qt, because it offered the same - GUI without the need to delve into configuration of command lines and also possibility to use it on multiple operational systems. Visual Studio is just bound with one - MS and hardly opencv can be called open if it is so bound to MS.

I think, I've found answer. It was really lib directory, not bin, so it is answered.bin.

after reboot undefined reference to `cv::imread(std::string const&, int)'

I have Qt 5.3.0 for Android (Windows 32-bit, 813 MB) on Windows x64

Compiled opencv with cmake - both release and debug versions

PATH

c:\Dev\opencv\debug\install\x64\mingw\bin\;
c:\Dev\opencv\release\install\x64\mingw\bin\;
C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;
C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;
C:\Dev\CMake\bin;

.pro project file has only these lines added:

INCLUDEPATH += C:\\Dev\\opencv\\release\\install\\include
LIBS += -LC:\\Dev\\opencv\\release\\install\\x64\\mingw\\bin\\*.*

main.cpp simple test example

#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 on window
        cv::imshow("My Image", image);
        // wait key for 5000 ms
        cv::waitKey(5000);
        return 1;
}

This example was running. Now when I try to do the same after reboot - getting these results: C:\workspace\untitled7\main.cpp:9: error: undefined reference to `cv::imread(std::string const&, int)'

No clue at all what should be done. Apparently it doesn't link, but why it did in first run? Exactly the same result I'm getting in linux environment. Why?

I ended up with just adding libraries in this manner(different project, but tested and it worked for this example):

win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_core249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_highgui249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_imgproc249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_features2d249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_calib3d249.dll.a

No idea why it was working with initial settings. It was fresh System with new Qt install and compiled opencv. Since there has been many similar posts and none of themm have explained, that libraries can be linked to a .dll.a files, let' s hope that it will help other, who has similar Qt setup problems.

Also I'm curious why opencv is not shipping with prebuilt Qt libraries - it is not rare C/C++ tool and probably by now as widespread as Visual Studio. I was using Visual Studio for years and moved(run away) to Qt, because it offered the same - GUI without the need to delve into configuration of command lines and also possibility to use it on multiple operational systems. Visual Studio is just bound with one - MS and hardly opencv can be called open if it is so bound to MS.

I think, I've found answer. It was really lib directory, not bin.

PS Haha, I can' t close my own question or just don't know how to set it as answered

after reboot undefined reference to `cv::imread(std::string const&, int)'

I have Qt 5.3.0 for Android (Windows 32-bit, 813 MB) on Windows x64

Compiled opencv with cmake - both release and debug versions

PATH

c:\Dev\opencv\debug\install\x64\mingw\bin\;
c:\Dev\opencv\release\install\x64\mingw\bin\;
C:\Qt\Qt5.3.0\5.3\mingw482_32\bin;
C:\Qt\Qt5.3.0\Tools\mingw482_32\bin\;
C:\Dev\CMake\bin;

.pro project file has only these lines added:

INCLUDEPATH += C:\\Dev\\opencv\\release\\install\\include
LIBS += -LC:\\Dev\\opencv\\release\\install\\x64\\mingw\\bin\\*.*

main.cpp simple test example

#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 on window
        cv::imshow("My Image", image);
        // wait key for 5000 ms
        cv::waitKey(5000);
        return 1;
}

This example was running. Now when I try to do the same after reboot - getting these results: C:\workspace\untitled7\main.cpp:9: error: undefined reference to `cv::imread(std::string const&, int)'

No clue at all what should be done. Apparently it doesn't link, but why it did in first run? Exactly the same result I'm getting in linux environment. Why?

...

SOLUTION:

I ended up with just adding libraries in this manner(different project, but tested and it worked for this example):

win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_core249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_highgui249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_imgproc249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_features2d249.dll.a 
win32:LIBS += c:\Dev\opencv\release\install\x64\mingw\lib\libopencv_calib3d249.dll.a

No idea why it was working with initial settings. It was fresh System with new Qt install and compiled opencv. Since there has been many similar posts and none of themm them have explained, that libraries can be linked to a .dll.a files, let' s let's hope that it will help other, others, who has will have similar Qt setup problems.

Also I'm curious why opencv is not shipping with prebuilt Qt libraries - it is not rare C/C++ tool and probably by now as widespread as Visual Studio. I was using Visual Studio for years and moved(run away) to Qt, because it offered the same - GUI without the need to delve into configuration of command lines and also possibility to use it on multiple operational systems. Visual Studio is just bound with one - MS and hardly it is conflicting idea to call opencv can be called open if it is so bound to MS.

I think, I've found answer. It was really lib directory, not bin.

PS Haha, I can' t close my own question or just don't know how to set it as answeredanswered.