C++ 程序无法启动,因为缺少 opencv_core2410d.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28913116/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 21:06:36  来源:igfitidea点击:

The program can't start because opencv_core2410d.dll is missing

c++opencvvisual-studio-2012

提问by udith

I installed visual studio 2012.i have windows 8.1.then i extract opencv 2.4.10in c partition.

我安装了Visual Studio2012。我有 Windows 8.1。然后我在 c 分区中提取了opencv 2.4.10

Created the visual C++ project->win32 Console application.

创建了 Visual C++ 项目->win32 控制台应用程序。

As I have x64 machine

因为我有 x64 机器

 build menu->Configuration manager->platform->x64

then i set below configuration in my vs project.

然后我在我的 vs 项目中设置了以下配置。

project->properties->configuration->all configuration

VC++Directories->Library Directories->
  C:\opencv\build\x64\vc11\bin,C:\opencv\build\x64\vc11\lib

C/C++->Genaral->Additional Include Derectories->
    C:\opencv\build\include,C:\opencv\build\include\opencv2,C:\opencv\build\include\opencv

change the

改变

          Configuration->Debug
          Select Linker->Input->Additional Dependencies

    opencv_core2410d.lib
    opencv_highgui2410d.lib
    opencv_imgproc2410d.lib
    opencv_calib3d2410d.lib
    opencv_contrib2410d.lib
    opencv_features2d2410d.lib
    opencv_flann2410d.lib
    opencv_gpu2410d.lib
    opencv_legacy2410d.lib
    opencv_ml2410d.lib
    opencv_nonfree2410d.lib
    opencv_objdetect2410d.lib
    opencv_photo2410d.lib
    opencv_stitching2410d.lib
    opencv_superres2410d.lib
    opencv_ts2410d.lib
    opencv_video2410d.lib

then

然后

   change Configuration->Release
   select Linker->Input->Additional Dependencies

    opencv_core2410.lib
    opencv_highgui2410.lib
    opencv_imgproc2410.lib
    opencv_calib3d2410.lib
    opencv_contrib2410.lib
    opencv_features2d2410.lib
    opencv_flann2410.lib
    opencv_gpu2410.lib
    opencv_legacy2410.lib
    opencv_ml2410.lib
    opencv_nonfree2410.lib
    opencv_objdetect2410.lib
    opencv_photo2410.lib
    opencv_stitching2410.lib
    opencv_superres2410.lib
    opencv_ts2410.lib
    opencv_video2410.lib
    opencv_videostab2410.lib

then i created a class and wrote the code

然后我创建了一个类并编写了代码

    #include "stdafx.h"
    #include "opencv2/highgui/highgui.hpp"
    #include "opencv2/core/core.hpp"

    int main(){
       //declare a new iplimage pointer
       IplImage*myimage;

       //load image
       myimage = cvLoadImage("D:\visual studio 2012\katussa.jpg",1);
       cvNamedWindow("Smile",1);
       cvShowImage("Smile",myimage);

       //wait for the key to close the window
       cvWaitKey(0);
       cvDestroyWindow("Smile");
       cvReleaseImage(&myimage);
       return 0;
    }

when i run i got the error message The program can't start because opencv_core2410d.dll is missing.

当我运行时,我收到错误消息 The program can't start because opencv_core2410d.dll is missing

回答by GPPK

You need to add OpenCV to your system path:

您需要将 OpenCV 添加到您的系统路径中:

You need to add the directory C:\opencv\build\x86\vc10\bin to your system PATH. This directory contains OpenCV DLLs required for running your code.

您需要将目录 C:\opencv\build\x86\vc10\bin 添加到您的系统路径中。此目录包含运行代码所需的 OpenCV DLL。

Open Control Panel → System → Advanced system settings → Advanced Tab → Environment variables...

打开控制面板 → 系统 → 高级系统设置 → 高级选项卡 → 环境变量...

On the System Variables section, select Path (1), Edit (2), and type C:\opencv\build\x86\vc10\bin; (3), then click Ok.

在 System Variables 部分,选择 Path (1),Edit (2),然后键入 C:\opencv\build\x86\vc10\bin;(3),然后单击确定。

ninja edit:

忍者编辑:

make sure you have follow allthe steps on this tutorial

确保您已按照本教程中的所有步骤进行操作

回答by kchak

Sometimes you may get this error even when you have added the relevent bin file, for example \opencv-x.x.x\build\install\x64\vc15\bin, to the System Path Environment Variable.

有时,即使您已将相关 bin 文件(例如\opencv-x.x.x\build\install\x64\vc15\bin,添加到系统路径环境变量),也可能会收到此错误。

In my case, it worked once I rebooted my PC. Or maybe just restart visual studio and see if it's working, before you reboot the system.

就我而言,一旦我重新启动我的电脑,它就起作用了。或者,也许只是在重新启动系统之前重新启动 Visual Studio 并查看它是否正常工作。