Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
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.

		
Posted 19-Nov-12 6:36am
wadeaa591
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
wadeaa at 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?
Marcus Kramer at 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 at 20-Nov-12 14:21pm
   
I agree, decompilers are usually not very good at all. +5
Sergey Alexandrovich Kryukov at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
Comments
Marcus Kramer at 19-Nov-12 16:07pm
   
+5. Nice.
Sergey Alexandrovich Kryukov at 19-Nov-12 16:31pm
   
Thank you, Marcus.
--SA
Albert Holguin at 20-Nov-12 14:22pm
   
Good advice... +5
Sergey Alexandrovich Kryukov at 20-Nov-12 14:31pm
   
Thank you, Albert.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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

  Print Answers RSS
0 Maciej Los 450
1 OriginalGriff 403
2 Sergey Alexandrovich Kryukov 219
3 Peter Leow 190
4 CPallini 189
0 OriginalGriff 6,092
1 Sergey Alexandrovich Kryukov 5,022
2 Maciej Los 3,269
3 Peter Leow 3,164
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100