Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to migrate/convert a code of C++ ,built on Borland 2007 to Visual Studio 2010

Tags:

c++

visual-c++

Please guide me, as how to convert a C++ code of Borland 2007 in to Visual Studion 2010 code. I just need to ask, whether to write all th code again for 2010 or is there any shortcut for this conversion/migration.

like image 458
Asad Avatar asked Jul 12 '10 02:07

Asad


4 Answers

i did and it worksd for me-

remove .h from include do not do it for other libraries,

remove clrscr(); everywhere and replace by system("cls");

finally after writing all #include stuff add this-

using namespace std; it allows you to do things like cin>> cout<< etc.

like image 76
mr-crazy Avatar answered Nov 19 '22 16:11

mr-crazy


If the code was written portably to begin with, there should be no issues. Other than that, all I can say is to run the code through Visual Studio's compiler and see if you get errors or anything of that nature.

After that, test the output to ensure you're getting correct behavior.

like image 32
Billy ONeal Avatar answered Nov 19 '22 15:11

Billy ONeal


Are you using any Borland proprietary components?

If so, I'd say you're out of luck. You'd have to replace those components, and this is likely not to be easy. I should say you may not find a tool that can automatically "translate" these.

If not, it should be easier. But be aware that Borland compiler has support for many things that are not C++ standard. If your code is portable enough, you'll be fine just recompiling it under VS. You might have to change some header files, replace some pragmas, but nothing too complicated.

like image 1
jweyrich Avatar answered Nov 19 '22 16:11

jweyrich


If you're using the Borland GUI (TButton, etc) then you have some real work to do. Every one of them will need to be replaced with something Visual Studio knows - most probably MFC. About the time Visual C++ 4 was released I actually wrote a giant set of scripts (mostly using sed and awk) to convert a large codebase - it was not pleasant, the parameters are in different orders and the methods return slightly different types. It was worth it in that case - tens of thousands of lines of code and a strong business desire to switch tools. In your case since you say you have a "simple windows form with new controls" I would say start a new project, build the form, then copy your old code in - entire files for classes and business logic, clumps of lines for event handles in the gui. Test very carefully.

Also, the default MFC look and feel isn't the same as the Borland default look and feel. On that long ago project we had to look identical so we had to play with a lot of properties and options. Be sure to ask your bosss if this matters.

like image 1
Kate Gregory Avatar answered Nov 19 '22 15:11

Kate Gregory