简体   繁体   English

“程序无法启动,因为您的计算机中缺少 opencv_world300.dll”错误 C++

[英]"The program can't start because opencv_world300.dll is missing from your computer" error in C++

I want to compile an opencv Console C++ program in Visual Studio 2013. This is my code:我想在 Visual Studio 2013 中编译一个 opencv 控制台 C++ 程序。这是我的代码:

#include "stdafx.h"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, const char** argv)
{
    Mat img = imread("rgb_1.png", CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file "MyPic.JPG" and store it in 'img'

    if (img.empty()) //check whether the image is loaded or not
    {
        cout << "Error : Image cannot be loaded..!!" << endl;
        //system("pause"); //wait for a key press
        return -1;
    }

    namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow"
    imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window

    waitKey(0); //wait infinite time for a keypress

    destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"

    return 0;
}

Although I have defined all the directories in properties both in Computer and Visual Studio directories, I get the following error:尽管我已经在 Computer 和 Visual Studio 目录的属性中定义了所有目录,但出现以下错误:

"The program can't start because opencv_world300.dll is missing from your computer." “程序无法启动,因为您的计算机中缺少 opencv_world300.dll。”

How can I fix this problem?我该如何解决这个问题?

Under windows you can copy it from:在 windows 下,您可以从以下位置复制它:

<your install directory>\opencv30\build\x64\vc12\bin

And put it in your Visual Studio solution (I assume you are using a x64/Release configuration):并将其放入您的 Visual Studio 解决方案中(我假设您使用的是x64/Release配置):

<your solution directory>\x64\Release

Or you you can add the above OpenCV to your PATH environment variable或者你可以将上面的 OpenCV 添加到你的 PATH 环境变量中

I had the same problem.我有同样的问题。

I'm on version 320 .我在版本320上。 Once all your environment variables are set make sure your Additional Include Directories , Additional Library Directories and Additional Dependencies are all correct.设置完所有环境变量后,请确保您的Additional Include DirectoriesAdditional Library DirectoriesAdditional Dependencies都是正确的。 For me they were $(OPENCV_BUILD)\include;对我来说,它们是$(OPENCV_BUILD)\include; , $(OPENCV_BUILD)\x64\vc14\lib; , $(OPENCV_BUILD)\x64\vc14\lib; and opencv_world320d.lib;opencv_world320d.lib; respectively.分别。

My OPENCV_BUILD path variable is C:\opencv320\build setting the environment variable to %OPENCV_BUILD%\x64\vc14\bin (where the .dll files are located) .我的OPENCV_BUILD路径变量是C:\opencv320\build将环境变量设置为%OPENCV_BUILD%\x64\vc14\bin (.dll 文件所在的位置) To get to the Additional things right-click on your project/solution and select properties -> C/C++ for the first and properties -> Linker -> General and Input for the other two.要获得Additional内容,请右键单击您的项目/解决方案,然后选择properties -> C/C++作为第一个, properties -> Linker -> GeneralInput作为其他两个。

Restart Visual Studio and if everything was implemented correctly then you should be able to run the program and it should start.重新启动 Visual Studio ,如果一切都正确实施,那么您应该能够运行该程序并且它应该启动。

Edit:编辑:

Depending on what you used I had to also switch mine from x86 to x64 in the Solution Platforms dropdown.根据您使用的内容,我还必须在Solution Platforms下拉列表中将我的从x86切换到x64

You can check your system variable to confirm the directory in which opencv_world300.dll is located (maybe C:\opencv\build\x64\vc12\bin ) is present.您可以检查系统变量以确认opencv_world300.dll所在的目录(可能是C:\opencv\build\x64\vc12\bin )是否存在。

If it exists but the problem still is not solved, try to put all .dll files in the directory to C:\WINDOWS\system32如果存在但问题仍未解决,尝试将目录下的所有.dll文件放到C:\WINDOWS\system32

我知道这是一篇旧文章,但我注意到我在区分libbin时存在问题,因此我将两者都添加到了 PATH 变量中并且它起作用了。

If this question is still relevant, I figured out the way.如果这个问题仍然相关,我想出了办法。

I presume you used the tutorial on the OpenCV website to setup OpenCV .我假设您使用OpenCV网站上的教程来设置OpenCV Once you run the command prompt and execute the command, it creates the environment variable for OpenCV but it does not add it in the path.运行命令提示符并执行命令后,它会为OpenCV创建环境变量,但不会将其添加到路径中。 So if you go to the path and add the location of the bin in vc12 (vc14 for me), save it, and restart visual studio, it works.因此,如果您转到路径并将 bin 的位置添加到 vc12(对我来说是 vc14)中,保存它,然后重新启动 Visual Studio,它就可以工作了。

After installing OpenCV version 3.4.1 for use with VS 2017 following these instructions , Visual Studio complained about missing opencv_world341d.dll .按照这些说明安装 OpenCV 版本 3.4.1 以与 VS 2017 一起使用后,Visual Studio 抱怨缺少opencv_world341d.dll Even though I had added C:\opencv\build\x64\vc15\bin to the windows PATH, Visual Studio still couldn't find it as VS was already open when I modified the PATH.即使我已将C:\opencv\build\x64\vc15\bin添加到 windows PATH 中,Visual Studio 仍然找不到它,因为当我修改 PATH 时 VS 已经打开。 Restarting Visual Studio fixed the problem.重新启动 Visual Studio 解决了该问题。

Best and simple solution is最好和简单的解决方案是

  1. Add path_variable of OpenCV/build/x64/bin in environment system variables.在环境系统变量中添加 OpenCV/build/x64/bin 的 path_variable。

  2. And then restart the visual studio.然后重新启动视觉工作室。

this definitely will solve the problem.这肯定会解决问题。

the problem might be you've updated the path variable after opening the visual studio so it can't update the *.dll files.问题可能是您在打开 Visual Studio 后更新了路径变量,因此它无法更新 *.dll 文件。

I just had the exact same problem using version 320. In my case my "Comodo Internet Security" was blocking a few things of the application itself and of OpenCV.我只是在使用 320 版时遇到了完全相同的问题。在我的情况下,我的“Comodo Internet Security”阻止了应用程序本身和 OpenCV 的一些东西。 Make sure to put them all on the "trusted" list by right clicking on them in your firewall.通过在防火墙中右键单击它们,确保将它们全部放在“受信任”列表中。

Add the paths as everybody says and keep in mind to restart the Visual Studio.按照每个人的说法添加路径,并记住重新启动 Visual Studio。 I added all the paths, even tried to copy all the opencv_world.dll in the same folder as the source file, all i had to do was to restart the Visual Studio after i added all the paths.我添加了所有路径,甚至尝试将所有opencv_world.dll复制到与源文件相同的文件夹中,我所要做的就是在添加所有路径后重新启动 Visual Studio。

In visual studio 2019, TRY THIS Add missing file opencv_world430.dll or opencv_worldd.dll in the debug directory of the project where your project application exe file is there.在 Visual Studio 2019 中,尝试在项目应用程序 exe 文件所在的项目的调试目录中添加缺少的文件 opencv_world430.dll 或 opencv_worldd.dll。 copy & paste missing files in the debug folder在调试文件夹中复制并粘贴丢失的文件

C:\Users\myname\source\repos\myopencv\x64\Debug + add your missing file here C:\Users\myname\source\repos\myopencv\x64\Debug + 在此处添加您丢失的文件

my problem got solved in microsoft visual studio 2019 :)我的问题在 microsoft visual studio 2019 中得到了解决 :)

I just upgraded OpenCV from OpenCV 4.1.2 to 4.5.1 and it solved this problem (Unhandled exception at 0x00007FFAD5A193D2 (opencv_world412d.dll))!我刚刚将 OpenCV 从 OpenCV 4.1.2 升级到 4.5.1,它解决了这个问题(未处理的异常在 0x00007FFAD5A193D2 (opencv_world412d.dll))! The only Visual Studio setting change is the dll additional file name from opencv_world412d.dll to opencv_world451d.dll.唯一的 Visual Studio 设置更改是将 dll 附加文件名从 opencv_world412d.dll 更改为 opencv_world451d.dll。

This most commonly occurs when you do not add the file in question to your path variable and restart visual studio.当您没有将相关文件添加到路径变量重新启动 Visual Studio 时,最常发生这种情况。

My opencv_world460.dll file was located in the following folder: C:\OpenCV-4.6.0\opencv\build\x64\vc14\bin .我的opencv_world460.dll文件位于以下文件夹中: C:\OpenCV-4.6.0\opencv\build\x64\vc14\bin I added this to my system variables PATH .我将此添加到我的系统变量PATH中。

Note in general, that when you update path variables, you must restart your console or visual studio.通常请注意,当您更新路径变量时,您必须重新启动控制台或 Visual Studio。 The path variables are only updated when you restart a console or when you restart visual studio.仅当您重新启动控制台或重新启动 Visual Studio 时,才会更新路径变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio c ++ LoadLibary错误:无法启动程序,因为计算机中缺少dll - Visual Studio c++ LoadLibary error: The program can't start because dll is missing from your computer 程序无法启动,因为您的计算机缺少mfc120ud.dll - The program can't start because mfc120ud.dll is missing from your computer 由于您的计算机上缺少freeglut.dll,因此无法启动该程序 - This program can't start because freeglut.dll is missing from your computer 该程序无法启动,因为您的计算机中缺少MSVCP90D.dll - The program can't start because MSVCP90D.dll is missing from your computer Qt + VS2010:程序无法启动,因为 <xyz> 您的计算机缺少.dll - Qt + VS2010: The program can't start because <xyz>.dll is missing from your computer 该程序无法启动,因为您的计算机缺少libgcc_s_dw2-1.dll。 简单的控制台 - The program can't start because libgcc_s_dw2-1.dll is missing from your computer. Simple console 运行OpenCv代码时出现系统错误“由于缺少opencv_core244.dll,因此无法启动程序” - System Error When Run OpenCv Code “The program can't start because opencv_core244.dll is missing” 程序无法启动因为缺少opencv_core2410d.dll - The program can't start because opencv_core2410d.dll is missing opencv_world300d.dll丢失 - opencv_world300d.dll is missing 该程序无法启动,因为缺少msvcr100.dll - the program can't start because msvcr100.dll is missing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM