# Adding OpenCV 4.5.3 to Visual Studio 2019

**URL:** <https://forum.opencv.org/t/adding-opencv-4-5-3-to-visual-studio-2019/4823>\
**Category:** C++\
**Tags:** windows, build\
**Created:** [August 18, 2021, 8:58am UTC](https://forum.opencv.org/t/adding-opencv-4-5-3-to-visual-studio-2019/4823 "2021-08-18T08:58:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![4x4](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/4x4/32/2947_2.png) [@4x4](https://forum.opencv.org/u/4x4)\
**Post date:** [August 18, 2021, 8:58am UTC](https://forum.opencv.org/t/adding-opencv-4-5-3-to-visual-studio-2019/4823/1 "2021-08-18T08:58:21Z")

</div>

Hi everyone,

I know there is google and I know there is a search function here in the forum but I can’t get it to work - either the tutorials are written for an older opencv version or for an older visual studio version or both…

I keep getting the LNK2019 error and I’m lost…

I followed the [Adding OpenCV 4.2.0 to Visual Studio 2019 project in Windows using pre-built binaries](https://subwaymatch.medium.com/adding-opencv-4-2-0-to-visual-studio-2019-project-in-windows-using-pre-built-binaries-93a851ed6141) tutorial first but without success.  
I understand what the error message is trying to tell me but I have no more ideas how to solve it…

maybe someone here can point out what needs to be done different compare to the mentioned tutorial above…

Kind Regards  
Tobi

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [August 18, 2021, 9:05am UTC](https://forum.opencv.org/t/adding-opencv-4-5-3-to-visual-studio-2019/4823/2 "2021-08-18T09:05:59Z")

</div>

generate an empty VS solution using the cmake recipe.

then look at what’s set in that thing.

if you want help, you have to provide facts (logs). you haven’t given any. if you aren’t going to bother, expect little response.

---

<div class="post-metadata">

**Author:** ![4x4](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/4x4/32/2947_2.png) [@4x4](https://forum.opencv.org/u/4x4)\
**Post date:** [August 18, 2021, 9:19am UTC](https://forum.opencv.org/t/adding-opencv-4-5-3-to-visual-studio-2019/4823/3 "2021-08-18T09:19:04Z")

</div>

Hi,

youre right - my fault:

that’s my little demo project:

 ![VS2019_Projekt](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/4/4e80d82890f3d4be3cda94d9fb30aeb867c7bbd2.png)

**Error Log:**

```auto
Fehler	LNK2019	
Verweis auf nicht aufgelöstes externes Symbol 
""bool __cdecl cv::imwrite(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::debug_build_guard::_InputArray const &,class std::vector<int,class std::allocator<int> > const &)" (?imwrite@cv@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_build_guard@1@AEBV?$vector@HV?$allocator@H@std@@@3@@Z)" in Funktion "main".	opencv-test	C:\Users\blattner\source\repos\opencv-test\opencv-test\opencv-test.obj	 

Fehler	LNK2019	
Verweis auf nicht aufgelöstes externes Symbol 
""void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@debug_build_guard@1@@Z)" in Funktion "main".	opencv-test	C:\Users\blattner\source\repos\opencv-test\opencv-test\opencv-test.obj	 

Fehler	LNK1120	
2 nicht aufgelöste Externe	opencv-test	C:\Users\blattner\source\repos\opencv-test\x64\Debug\opencv-test.exe

```

**VC++ Directories tab:**

 ![VS2019_VCDict](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/1/1c956bafda5062c097d9c62ddbe0ba77751184eb.png)  
**Linker tab:**  
 ![VS2019_Linker](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/0/0ce173670cf7e60c43db2b499ef8254f40334e60.png)  
**Environment variable:**  
 ![envvarPNG](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/2/22d0e0ef486b846c9175d8212c66ef81c815a9be.png)

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [August 18, 2021, 1:19pm UTC](https://forum.opencv.org/t/adding-opencv-4-5-3-to-visual-studio-2019/4823/4 "2021-08-18T13:19:20Z")

</div>

DON’T link both `d` and non-`d` libraries at the same time.

do you even have a `world` library, or do you have module libraries?

have you logged out and back in again after editing the PATH variable?

and I repeat: just **generate** the VS solution with **cmake**. don’t mess around with this stuff manually before you know what the settings should be.

oh, and [VS 2019 is **vc16**](https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B), not 15. check that this is all correct.

---

<div class="post-metadata">

**Author:** ![4x4](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/4x4/32/2947_2.png) [@4x4](https://forum.opencv.org/u/4x4)\
**Post date:** [August 19, 2021, 5:39am UTC](https://forum.opencv.org/t/adding-opencv-4-5-3-to-visual-studio-2019/4823/5 "2021-08-19T05:39:40Z")

</div>

Yes linking both d and non -d was an act of frustration → I fixed that

Yes I restarted the machine after editing the PATH variable.

What got me confused it in the tutorial it looks like three options to install:

1. Installation by Using the Pre-built Libraries

2. Installation by Using git-bash and cmake

3. Installation by Making Your Own Libraries from the Source Files

I went for 1) because it looked straight forward and simple and was matching the tutorial I linked in my first post.

But anyhow, I followed your recommendation and followed the "Installation by Using git-bash and cmake tutorial…

But instead of step 8 of the tutorial: “Drink a coffee or two…” I called it a day.

New day new happiness - at this point the tutorial isn’t really much help anymore because it’s referring to another version. But I thought I figured it out - fixed the file paths because they slightly changed…

and… it works 🤩 thank’s to @crackwitz
