# VIsual Studio problems

**URL:** <https://forum.opencv.org/t/visual-studio-problems/12120>\
**Category:** C++\
**Tags:** build\
**Created:** [February 24, 2023, 5:47pm UTC](https://forum.opencv.org/t/visual-studio-problems/12120 "2023-02-24T17:47:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raivore](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@raivore](https://forum.opencv.org/u/raivore)\
**Post date:** [February 24, 2023, 5:47pm UTC](https://forum.opencv.org/t/visual-studio-problems/12120/1 "2023-02-24T17:47:23Z")

</div>

Visual Studio build latest OpenCV package in Debug & Release version. I want to use AddingImage.cpp to test it and build it succesfully with static libraries but on runtime I get an error

```auto
---------------------------
ConsoleApplication1.exe - System Error
---------------------------
The code execution cannot proceed because opencv_core470d.dll was not found. Reinstalling the program may fix this problem. 
---------------------------
OK   
---------------------------

```

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [February 25, 2023, 8:53am UTC](https://forum.opencv.org/t/visual-studio-problems/12120/2 "2023-02-25T08:53:19Z")

</div>

> [@raivore](#):
>
> I want to use AddingImage.cpp to test it and build it succesfully with static libraries

if it depends on that dll, you did not link it against _static_ , but dynamic libs  
(if that’s ok, at least make sure, the folder containing the opencv dll’s is on the PATH, so they can be found at runtime)

use `BUILD_SHARED_LIBS=OFF` cmake option to build static opencv libs

---

<div class="post-metadata">

**Author:** ![raivore](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@raivore](https://forum.opencv.org/u/raivore)\
**Post date:** [February 25, 2023, 11:20am UTC](https://forum.opencv.org/t/visual-studio-problems/12120/3 "2023-02-25T11:20:54Z")

</div>

if I use dll builld of program I get following error -

| Severity | Code | Description | Project | File | Line | Suppression State |
| --- | --- | --- | --- | --- | --- | --- |
| Error | LNK1107 | invalid or corrupt file: cannot read at 0x3D0 | ConsoleApplication1 | C:\Users\Raivo\opencv-4.7.0\build\bin\Debug\opencv\_calib3d470d.dll | 1 | |

I build opencv package with Visual Studio twice and got same

---

<div class="post-metadata">

**Author:** ![cudawarped](https://avatars.discourse-cdn.com/v4/letter/c/9dc877/32.png) [@cudawarped](https://forum.opencv.org/u/cudawarped)\
**Post date:** [February 27, 2023, 7:17am UTC](https://forum.opencv.org/t/visual-studio-problems/12120/4 "2023-02-27T07:17:06Z")

</div>

Are you adding `C:\Users\Raivo\opencv-4.7.0\build\bin\Debug\opencv_calib3d470d.dll` to

> Properties-\>Linker-\>Input-\>Additional Dependencies?

instead of `C:\Users\Raivo\opencv-4.7.0\build\lib\Debug\opencv_calib3d470d.dll`?

If so that’s your problem, you need to add the .lib to the linker for compilation and the .dll to your system/user path for runtime.
