OpenCV3: Lnk 2019 errors despite linking all libraries including the numerous libs from staticlib directory

asked 2015-08-12 13:10:05 -0500

Surya Kameswara Rao Ebix gravatar image

updated 2015-08-12 13:45:13 -0500

unxnut gravatar image

I have a vc++ 32 bit console application I have all the paths set correct, all the libraries included including the numerous libs from staticlib directory. VSS 2013 target architecture is set to x64 on windows 8 i7 machine. Still I get the following errors for the following code:

int main(int argc, char* argv[]){
    int i;
    std::cout << "OpenCV Version: " << CV_VERSION << std::endl;
    cv::Mat img = cv::imread("D:\opencvImages\OpenCvImg.png",CV_LOAD_IMAGE_COLOR);
    cv::namedWindow("imgwin",CV_WINDOW_AUTOSIZE);
    cv::imshow("imgwin", img);
    std::cin >> i;

    return 0;

}

Link errors:

Error   3   error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPEAX@Z) referenced in function "public: __cdecl cv::Mat::~Mat(void)" (??1Mat@cv@@QEAA@XZ)   D:\Projects\cappTest\cappTest\main.obj  cappTest
Error   4   error LNK2019: unresolved external symbol "private: char * __cdecl cv::String::allocate(unsigned __int64)" (?allocate@String@cv@@AEAAPEAD_K@Z) referenced in function "public: __cdecl cv::String::String(char const *)" (??0String@cv@@QEAA@PEBD@Z)    D:\Projects\cappTest\cappTest\main.obj  cappTest
Error   5   error LNK2019: unresolved external symbol "private: void __cdecl cv::String::deallocate(void)" (?deallocate@String@cv@@AEAAXXZ) referenced in function "public: __cdecl cv::String::~String(void)" (??1String@cv@@QEAA@XZ)  D:\Projects\cappTest\cappTest\main.obj  cappTest
Error   6   error LNK2019: unresolved external symbol "public: void __cdecl cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QEAAXXZ) referenced in function "public: void __cdecl cv::Mat::release(void)" (?release@Mat@cv@@QEAAXXZ)    D:\Projects\cappTest\cappTest\main.obj  cappTest
Error   7   error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::imread(class cv::String const &,int)" (?imread@cv@@YA?AVMat@1@AEBVString@1@H@Z) referenced in function main    D:\Projects\cappTest\cappTest\main.obj  cappTest
Error   8   error LNK2019: unresolved external symbol "void __cdecl cv::namedWindow(class cv::String const &,int)" (?namedWindow@cv@@YAXAEBVString@1@H@Z) referenced in function main   D:\Projects\cappTest\cappTest\main.obj  cappTest
Error   9   error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class cv::String const &,class cv::_InputArray const &)" (?imshow@cv@@YAXAEBVString@1@AEBV_InputArray@1@@Z) referenced in function main  D:\Projects\cappTest\cappTest\main.obj  cappTest

Libraries included in additional dependencies are:

opencv_ts300.lib
opencv_ts300d.lib
opencv_world300.lib
opencv_world300d.lib
opencv_core300d.lib
opencv_imgproc300d.lib
opencv_highgui300d.lib
opencv_ml300d.lib
opencv_video300d.lib
opencv_features2d300d.lib
opencv_calib3d300d.lib
opencv_objdetect300d.lib
opencv_flann300d.lib
opencv_hal300d.lib
opencv_imgcodecs300d.lib
opencv_photo300d.lib
opencv_shape300d.lib
opencv_stitching300d.lib
opencv_superres300d.lib
opencv_video300d.lib
opencv_videostab300d.lib
opencv_videoio300d.lib
IlmImfd.lib
libjasperd.lib
ippicvmt.lib
libjpegd.lib
libpngd.lib
libtiffd.lib
libwebpd.lib

Where am I going wrong?

edit retag flag offensive close merge delete

Comments

3

Combining both debug libs and release libs does not work ...choose one or the other ...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-12 13:31:13 -0500 )edit
1

I find that a lot of people just try to include everything. It will be better if you pay attention to what symbols need to be linked and link with just the appropriate libraries. In your case, all you seem to need are opencv_highgui300d.lib and opencv_core300d.lib.

unxnut gravatar imageunxnut ( 2015-08-12 13:49:05 -0500 )edit
1

combining both opencv_world and single module (non-world) libs won't work either.

berak gravatar imageberak ( 2015-08-12 23:36:17 -0500 )edit

Versions: Windows 8, VisualStudio-13, OpenCV-3 OK I have chosen only debug libs and the only two as suggested opencv_highgui300d.lib and opencv_core300d.lib. I still have the same errors. I have developed advanced machine learning stuff for OSX and Linux without any issues, it was like a symphony on those platforms. The moment I switch to windows a dumb display image program is also a mighty challenge. Is there a real solution on windows with OpenCV3 or is it like we have to use an older version of OpenCV for windows.

Surya Kameswara Rao Ebix gravatar imageSurya Kameswara Rao Ebix ( 2015-08-12 23:48:59 -0500 )edit

OpenCV3 works perfectly fine here. I am guessing there is still something wrong. Did you set your PATH variable correctly?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-08-13 03:04:08 -0500 )edit

Looked over your code again. Please add cv::waitKey() after imshow. Also, I missed the library opencv_imgcodecs300d.lib. Tell me if you still have errors.

unxnut gravatar imageunxnut ( 2015-08-13 10:25:16 -0500 )edit