简体   繁体   English

如何在Visual Studio 2010 C ++中使用所需的.dll和lib(opencv)文件制作.exe文件包

[英]How to make package of .exe file with required .dll and lib (opencv) files in visual studio 2010 C++

I have created an opencv project which include path having headers,*.lib and *.dll files of opencv in project properties and I have hard coded path of header files of opencv in .cpp that I have created.Let us say I need to give this project to customer,hence I only need to give .exe file of execution directly in customer system. 我创建了一个opencv项目,在项目属性中包含具有opencv的标头,*。lib和* .dll文件的路径,并且在我创建的.cpp中具有opencv的标头文件的硬编码路径。让我们说我需要将这个项目交给客户,因此我只需要直接在客户系统中提供执行的.exe文件。

so please anyone help how I can do packaging of path of .dll and .lib along with my project .exe file. 所以请任何人帮助我如何打包.dll和.lib路径以及我的项目.exe文件。 or are there any other way where i can send .exe file to customer which comprises of all ie can execute opencv and also my logic in customers system. 或者还有其他方法可以将.exe文件发送给客户,其中包括可以执行opencv以及客户系统中我的逻辑的所有内容。

thanks in advance and sharing answer is always appreciable. 在此先感谢,分享答案总是很有意义的。

Either use relative paths for everything you're using and ship them along ( if you're allowed to , check the licenses first!!), or if you need to give your users the source code (as a VS solution) and you can't/don't want to hardcode the paths of your tools use CMake to generate the solution files. 您可以使用相对路径来使用所有内容,然后将它们一起运送( 如果允许 ,请先检查许可证!!),或者是否需要向用户提供源代码(作为VS解决方案),您可以't /不想对您的工具路径进行硬编码,请使用CMake生成解决方案文件。

If you need to package binaries together along with your executable (and still, you're allowed to), you can use an installer packaging app like Inno Setup 如果您需要将二进制文件与可执行文件一起打包(仍然允许),则可以使用Inno Setup之类的安装程序打包应用程序

You need to make sure every dependency needed by your application is shipped otherwise your customers won't be able to run your software. 您需要确保应用程序所需的每个依赖项都已交付,否则客户将无法运行您的软件。 To find out dependencies in a Win environment, try to use the dependency tool shipped with each copy of visual studio. 若要找出Win环境中的依赖项 ,请尝试使用Visual Studio的每个副本附带的依赖项工具

As a sidenote: you shouldn't be putting complete absolute paths in the include directives, eg 附带说明:您不应该在include指令中放置完整的绝对路径,例如

#include "C:\mysystem\helloworld\app\opencv\header.h"

because that is the sure recipe for compilation problems or unnecessary preprocessing when deploying or redistributing your sources. 因为这是部署或重新分发源代码时解决编译问题或进行不必要的预处理的可靠方法。 This doesn't apply to binaries: they just need to find the compiled dependencies/tools they need. 这不适用于二进制文件:他们只需要找到所需的已编译依赖项/工具。

Visual Studio 2010 Does not provide the package creation for C++. Visual Studio 2010不提供C ++的程序包创建。

In My Opinion you have to use third party software like [Advanced Installer] 1 who search for the required dll and provide us to create the package as an installer. 在“我的意见”中,您必须使用第三方软件,例如[Advanced Installer] 1 ,它可以搜索所需的dll并提供给我们以创建安装程序包。

And for the paths you have included in the Header. 对于标题中包含的路径。

If You Have a .exe then it does not matter for running your application. 如果您有一个.exe那么对于运行您的应用程序来说并不重要。

Hope this will help you. 希望这会帮助你。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM