Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have .h and .lib and .dll files and I have Lost .cpp file, I need to know if i can recover it(.cpp) from .h or .dll or .lib files. And i have built them by using mfc vc++. Yhanks Alot for help.
C++

Posted

If the content from a cpp file was in the h file, then what would be the point of the cpp file in the first place. Of course you can't recover a cpp file from the header. You can, however, use the header to know the functions that were defined in the cpp.
In the case of a dll, I suppose you may find a decompiler out there that would do some of the work for you, but you're likely out of luck and will need to rewrite the file.
NOTE: This is why ALL code that is written should be saved in a code repository consistently so that these things don't happen.
 
Share this answer
 
Comments
wadeaa 19-Nov-12 13:06pm    
Thanks for reply, the code is so much huge to rewrit it again do you know sir and good decompiler for doing such a thing?
fjdiewornncalwe 19-Nov-12 13:15pm    
I don't because I don't really trust them.
In the future you should make sure to use source control and backups to ensure that you don't lose stuff again.
Albert Holguin 20-Nov-12 14:21pm    
I agree, decompilers are usually not very good at all. +5
Sergey Alexandrovich Kryukov 19-Nov-12 15:59pm    
Agree, a 5.
And I added quite a practical advice on what to do: to focus on future. Please see.
--SA
It's too late to restore the code. Like it or not, writing the code again can be still easier then decompilation.

You should rather forget about the lost code and concentrate of the future efforts. And, for the immediate future, you should realize: right now, you are not really developing code and care about your valuable code asserts, because you are not using Revision Control Systems, http://en.wikipedia.org/wiki/Revision_Control_System[^].

You should start using one immediately, not tomorrow, but today. It can be open-source and free, well maintained, extremely lightweight and, most importantly, extremely dependable. Please see this discussion:
Revision control systems, which to choose from?[^].

For some more information on some particular systems, please see my past answers:
Needs some words of wisedom to set up and/or use a server[^],
Make an unclickable form[^],
How can i structured to arrange source code when i create a new solution[^],
Reviews at Apache Subversion[^].

—SA
 
Share this answer
 
Comments
fjdiewornncalwe 19-Nov-12 16:07pm    
+5. Nice.
Sergey Alexandrovich Kryukov 19-Nov-12 16:31pm    
Thank you, Marcus.
--SA
Albert Holguin 20-Nov-12 14:22pm    
Good advice... +5
Sergey Alexandrovich Kryukov 20-Nov-12 14:31pm    
Thank you, Albert.
--SA
You could try some of these suggestions[^], but be prepared for a lot of work. Unless your LIB/DLL was built with debug information the decompilers have to make a lot of guesses as to the structure of the original source.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900