Article View: comp.os.os2.programmer
Article #240Re: GCC 2.1: what files do I need?
From: David Charlap
Date: Tue, 04 Aug 1992 19:37
Date: Tue, 04 Aug 1992 19:37
95 lines
5046 bytes
5046 bytes
In article <BsFuB9.3xB@undergrad.math.waterloo.edu> ychung@napier.uwaterloo.ca (Young Chung) writes: >Recently the existence of gcc 2.1 was pointed out to me. May sound foolish >but I've never, seriously, programmed in C/C++ nor had I ever owned such >compiler. >The truth is that I have to learn C/C++ in next few months and I thought >GCC would be a good choice since I don't have to spend $$$ other than printing >the docs. Yes. >So I like to know what I need to get from hobbes or any other ftp sites to be >able to use gcc with no problem. You can use either the emx/gcc port or the gcc port. The emx/gcc port will provide better Unix compatibility. The "plain" gcc port provides better access to the OS/2 API (complete with the toolkit, sold separately from IBM). I have the "plain" gcc port installed. All you need to do is download the gcc21bin.zoo file from ftp-os2.nmsu.edu. It's big (over 1.44MB, so you'll have to split it somehow in order to transport it over floppies) and it contains all you need. Use the "zoo" program (not booz) do unpack it into its proper directory tree. Set some environment variables in config.sys and go. If you look at the make files which come in the examples directory, you'll see how to compile a c program, a c++ program, and an OS/2 PM program. For learning c++, either package will work, however. Both conform to the C++ version 3 spec (with templates, etc.). I highly recommend Bjarne Stroustrup's book on C++ as a reference and a pretty good learning aid. Gcc (either port) should compile all of the book's examples. >Also, any helpful info on porting DOS programs to OS/2 provided that I have >the source code for the DOS version (say Turbo C++ for example) would be >appreciated. If your code is ANSI-compliant, there shouldn't be any problems. If you use any Borland or Microsoft language extensions, you're going to have to re-code parts of the program. Note that I/O streams (like stdout) are fully buffered by default (they're unbuffered in MS and Borland compilers), so you'll have to insert fflush(stdout) statements in places at times or change the buffering to non-buffered using the setvbuf() function. Note that Turbo C++ (and I think BC++) doesn't use make files. It uses project files, which are different. I don't think it should be difficult to make a make file from a project file, but I've never done it. >Finally, what's the difference between emx and gcc? Do I need both? >Does gcc 2.1 come with a make program? Does it need one? (Dumb question) >Where do I get one? etc.. Differences: 1) compatibility. emx/gcc is more Unix compatible. It creates Unix-style libraries, usesa port of a Unix linker, and the executables are in Unix format (with a wrapper for OS/2 to execute). Emx/gcc compiles most Unix code easilly, although there is still no way under OS/2 to perform a fork() operation. Emx/gcc doesn't support the complete OS/2 API, and it's difficult to use libraries generated with other compilers. Gcc (native port) is closer to OS/2. It contains fewer Unix extensions, but will allow access to almost all of the OS/2 API (all of it if you buy IBM's toolkit - $79 from many vendors). It uses the OS/2 link386.exe program (included in OS/2 2.0), produces Microsoft/Intel/IBM style libraries and the executables are native OS/2 code. 2) Portability. Gcc (native) code will only run under OS/2 2.0 Emx/gcc code will also run under DOS, using the Emx DOS extender. It requires the EMX.DLL file be installed for OS/2 operation. I don't know if it will work under OS/2 1.x. 3) Patch level. Emx/gcc has been patched to gcc level 2.2, although I don't think the binary distribution has been upgraded yet. Gcc (native) has not been upgraded and is at version 2.1. I think Emx/gcc comes with a make program. Gcc does not. Note that the NMAKE.EXE prgram (included in the toolkit and with many Microsoft compilers) will work on Unix-like make files. One is not necessary, although it makes your life much easier. There are some make programs available on the Net, but I haven't looked for any. (I have nmake, which came with Microsoft C 6.0) -- |) David Charlap "I don't even represent myself /|_ dic5340@hertz.njit.edu sometimes so NJIT is right out!. ((|,) ~|~ Hi! I am a .signature virus, copy me into your .signature file.
Technical Details
Message-ID:
<1992Aug4.193741.21452@njitgw.njit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!gatech!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340References:
<BsFuB9.3xB@undergrad.math.waterloo.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340 From: dic5340@hertz.njit.edu (David Charlap) Newsgroups: comp.os.os2.programmer Subject: Re: GCC 2.1: what files do I need? Message-ID: <1992Aug4.193741.21452@njitgw.njit.edu> Date: 4 Aug 92 19:37:41 GMT References: <BsFuB9.3xB@undergrad.math.waterloo.edu> Sender: news@njit.edu Organization: New Jersey Institute of Technology, Newark, N.J. Lines: 95 Nntp-Posting-Host: hertz.njit.edu