Discussion Locked

developing C++ program in Unix

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hi, pls shed some light to my questions below,

1. what's the different of compilling c++ in unix compare to compilling c++ in windows platform?

2. can i compile my c++ code using Visual c++ n upon succesfull of compilation, ported it to unixand
recompile again.. will it be any erros then?

3. what are the IDEs available in Unix platform to develop C++ programs?

thanks
sk

5 replies

by kevin.riggs

ANSI standard C is the same on either platform and as long as you stay away from Microsoft extensions such as MFC or ATL then your code should port to the Unix environment.

I wouldn't use MS Visual C++ to build your application if you want it to compile correctly in Unix. You'll be better off using Borland or someone's compiler or working in Unix and then porting into Visual C++.

I'm sure there are some visual IDE's for Unix platform but the only real development I've worked with has been in using a text editor to write the C (or cpp) and then running gcc (GNU C compiler) to link and build (make) the program. I'm not sure what changes you might need to make for CPP, though.

by dujie123

A1. First, Unix and MS Windows are different OS, so if your c++ program uses OS specific features such as multi-thread/fork and XWindows/MS Win32API then it will not compile in both OS. Secondly, Compilling c++ in unix usually invokes "make" utilityand a Makefile, the syntax of Makefile may differ depending on the "make" utility in both OS. Also, the name of standard c++ libraries are different, so you must be sure that the "LIB" settings in makefile is correct.

A2. Yes, according to A1, your c++ program compiled successfully in VC++ does not ensure that it will be ready for unix. Stick to Ansi-C/C++ standard, and check if your unix c++ compiler supports exception handler, RTTI or STL, After exporting a Makefile from VC++ IDE, try to edit it carefully before compilling in Unix.

A3. Yes, you may find some IDEs in Unix, depends on which version of Unix you are running. SunOs has 'WorkShop', Linux has Emacs, also Borland C++ builder may have been ported to Linux. At least, you can run Vi and Make in different XTerms, sometimes the simplest is the best. :-)

This discussion is closed to new replies.