I use Visual Studio 2017 Community for C++ coding. I have made a simple win32 console app and do not want to expose my code. I have also found the .exe file in the debug folder of the solution. When I try copying the .exe file in the Debug folder in another folder it says that the dll isn't found.I also tried copying the whole folder but the same error occurs. Please help me...I want to run my app on another computer also.
-
1" I do not want to expose my code" ?? I think it is difficult to help without know what you have already tried – limonik Jan 12 '18 at 13:22
-
1The VS tool "depends.exe" can help. – 001 Jan 12 '18 at 13:25
-
Is it possible that the DLL is located in some relative path, like "../
"? – Dominique Jan 12 '18 at 13:27 -
1. compile as **Release** 2. what is _the dll_ – Jan 12 '18 at 13:28
-
@JohnnyMopp : Is it distributed with Visual Studio now? – Martin Bonner supports Monica Jan 12 '18 at 13:32
-
@JohnnyMopp How to use the tool depends.exe? – Anonymous Jan 12 '18 at 13:33
-
@MartinBonner Not sure - I have many versions of VS. Looks like you can download here: http://www.dependencywalker.com/ – 001 Jan 12 '18 at 13:35
-
@Anonymous : Read the fairly extensive documentation that comes with it. You are expected to show a little bit of initiative and prior research here! – Martin Bonner supports Monica Jan 12 '18 at 13:37
-
@Anonymous Just open the exe with depends and it shows all the dlls the exe requires. It's pretty basic but helpful. – 001 Jan 12 '18 at 13:37
2 Answers
You can Generate Code Map for Solution.
Navigate to Architecture –> “Generate Code Map for Solution”
Which shows the inter-dependency between modules and libraries.
In your case by just copying the exe, you are breaking the references to all of the required libraries. Depending on your scenario, you have two good options. Copy the entire source tree + dependencies for you project and recompile it in the new working directory or create an installer which will allow you to distribute dlls and any other required resources.

- 1,553
- 1
- 14
- 39
-
-
-
-
1@Anonymous my friend... the first line of my answer is a link to detailed instructions, the second line of my answer is a brief description of how to generate the map. What more do you want. Shall I come over and make the two mouse clicks for you? – ldgorman Jan 12 '18 at 13:40
This is more complicated that one might hope. To answer the question in the title, you need Dependency Walker. (The web site doesn't mention Windows 10, but this stuff hasn't changed much recently, so don't worry about that.)
To distribute the program to another machine, you need to create a release build (the debug run-time libraries are not redistributable). Once you have done that, you will almost certainly find that the other machine already has the release run-time library, but you will need to copy other libraries.

- 28,528
- 3
- 51
- 88