How to include all dll's in exe?

前端 未结 4 637
不知归路
不知归路 2021-02-14 16:04

I have a Visual Studio 12 project; source code written in C++; it\'s an OpenCV project. I want to give my compiled program to someone else, but, on other PC, I getting an error

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-14 16:55

    DLLs themself can not be "statically linked" into an executable; that completely defies their purpose (well, actually you can use some really weird voodoo tricks to actually do it, but this is neither recommendable nor should you try it if you have to ask this question).

    The simple solution would be to identify all the DLLs your program requires (just starting the program in the Debugger will generate a log file listing them all) and copy those DLLs into the same directory as the EXE resides in; as it happens the directory with the EXE file in is also the first directory where the system looks for DLLs before advancing to the standard system directories in default configuration. Package it up and distribute it that way.

提交回复
热议问题