LNK2019: unresolved external symbol error in Visual Studio C++

前端 未结 4 2002
野性不改
野性不改 2020-12-18 23:25

This is my code in Visual Studio C++

#include \"stdafx.h\"
#include
#include

using namespace cv;

int main(int          


        
相关标签:
4条回答
  • 2020-12-19 00:12

    'unresolved external symbol' means that you're not linking with required library. Go to Properties -> Linker -> Additional Library dependencies and add path to OpenCV libs.

    0 讨论(0)
  • 2020-12-19 00:20

    First check How to build applications with OpenCV inside the Microsoft Visual Studio

    If you still suffer from the same problem, you could be under one of the below cases.

    1. Your active solution platform is x86 but you are trying to link x64 OpenCV libraries.
    2. Your active solution platform is X64 but you are trying to link x86 OpenCV libraries.

    If you are under one of these cases, check Compiling a 64-bit Application in Microsoft Visual Studio Express 2010

    0 讨论(0)
  • 2020-12-19 00:21

    i searched a lot for the same problem this was the best solution i had found and it worked for me.

    Open Configuration Properties > C/C++ > General, and edit the field Additional Include Directories to add these 3 paths (for the headers):

    C:\OpenCV2.3\build\include\opencv

    C:\OpenCV2.3\build\include\opencv2

    C:\OpenCV2.3\build\include

    0 讨论(0)
  • 2020-12-19 00:22

    Add these into your code:

    #pragma comment (lib, "opencv_core248d.lib")
    #pragma comment (lib, "opencv_highgui248d.lib")
    #pragma comment (lib, "opencv_imgproc248d.lib")
    #pragma comment (lib, "opencv_video248d.lib")
    #pragma comment (lib, "opencv_features2d248d.lib")
    

    It worked for me.

    0 讨论(0)
提交回复
热议问题