I lost the source code to an executable file but still have the actual file. Is there any way to retrieve the original C++ code?
-
No, there is no way. – Igor Tandetnik May 03 '18 at 01:18
-
No. The original source code is not contained in the executable. You can decompile to some form of assembly. Of course, Google could have answered this question for you easily. So could a simple search here: https://stackoverflow.com/q/3928318/62576 – Ken White May 03 '18 at 01:20
-
11"Of course, Google could have answered this question for you easily." How do you think most users ended up here? – sf_jeff Aug 31 '20 at 16:28
3 Answers
Duplicate of this question here.
Yes, it is possible, however when it comes to peeking function bodies and the like, you might have a little less luck. Operating systems like Kali Linux specialize in de-compilation and reverse engineering, so maybe look into a VM of that. And of course, windows has a lot of applications you can use as well to check the application code.
Look over the other question for specific app suggestions. :)
- Edit : You will most likely have lost all your logic and function bodies, but you might be able to recover the overall structure. It's your EXE so you might be more familiar with how it was all connected up.

- 788
- 3
- 14
-
3If it's a duplicate, then flag it as such and provide the link to that duplicate instead of posting an answer. (Once you've reached sufficient rep, you can directly vote to close it as a duplicate.) – Ken White May 03 '18 at 01:22
-
1
You cannot get the original source code but you can decompile the binary into source code using tools given in this similar question: Is there a C++ decompiler?
The output source code will not look like the original as the compiler will have optimised the original source when generating the executable.

- 2,469
- 5
- 31
- 54
Short answer NO.
Long answer, because C++ doesn't use some intermediate code like C# or Java you cannot decompile the app in some readable format. But if you can read assembly maybe you can save some time.

- 215
- 2
- 6