🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.misc
Article #17702

Re: Need help on GNU/GCC compiler for OS/2

#17702
From: David Charlap
Date: Thu, 04 Mar 1993 22:10
46 lines
3069 bytes
In article <1993Mar4.044754.17560@math.ucla.edu> nzhong@oak.math.ucla.edu (Ning Zhong) writes:
>  I downloaded the GCC v.2.2.2 from ftp-os2.nmsu.edu (directory /pub/os2/2.0/
>programming/gcc2-2.2.2) and installed in my D: drive like this:
...
>and I did add these to my config.sys following the documentation , but 
>when I tried to compile the sample1.c ("hello world" sample program), I typed:
>    gcc -v sample1.c
>the output goes:  
>    cpp -lang-c -v -undef [bla bla bla] sample1.c D:/GCC/TMP/cc000008.i
>    cc1 D:/GCC/TMP/cc000008.i -quiet [bla bla bla] -o D:/GCC/TMP/cc000008.s
>    as  -o D:/GCC/TMP/cc000008.o D:/GCC/TMP/cc000008.s
>    o2obj D:/GCC/TMP/cc000008.o -o 000008.obj
>    ld  D:/GCC/TMP/cc000008.obj -lgcc -lc -lgcc
...
>I did try "gcc -c sample1.c" and then "link386 sample1.obj" though, and it 
>worked. I just want to know whether this can be done in a single command, 
>and using the GCC linker, if there is one. And a final question, what "-l"
>option should I use to compile a C++ program?

You should do this.  The normal procedure for GCC/2 (I don't know
about EMX/GCC - anyway, this looks symptomatic of GCC/2) is:

gcc -c filename.c
link386 filename.obj, filename.exe,,os2.lib,filename.def;

Note that a .def file is required if you write PM code, and is useful
even if you don't.  Most books on OS/2 programming (and the LINK386
documentation in the IBM toolkit/2) explain .def files.

ld is a Unix linker that accepts *.o files and *.a files instead of
*.obj and *.lib files.  It is not included with GCC/2, since it
couldn't link to IBM's .lib files anyway.  GCC produces .o files and
runs o2obj in order to produce .obj files from them.

Because of this, GCC/2 does not link, although a rexx script (ld.cmd)
could be written to accept the ld commands and run link386 with the
proper commands.

C++ code will require a collect step.  Use collect.exe to do this.  I
don't know exactly how, though.  I have not written any C++ code with
GCC.
-- 
David Charlap                 dic5340@hertz.njit.edu
begin 666 signature.txt
B22!C86XG="!B96QI979E('EO=2!D96-O9&5D('1H:7,A"@  
 
Technical Details
Message-ID: <1993Mar4.221055.5945@njitgw.njit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!howland.reston.ans.net!wupost!uwm.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
References: <1993Mar4.044754.17560@math.ucla.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,32d7bf4e17ba2c91,start
X-Google-Attributes: gid11318c,public
X-Google-Thread: 1044c2,32d7bf4e17ba2c91,start
X-Google-Attributes: gid1044c2,public
X-Google-Thread: 10121b,32d7bf4e17ba2c91,start
X-Google-Attributes: gid10121b,public
X-Google-ArrivalTime: 1993-03-04 14:10:55 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!howland.reston.ans.net!wupost!uwm.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
From: dic5340@hertz.njit.edu (David Charlap)
Newsgroups: comp.os.os2.misc,comp.os.os2.programmer,gnu.gcc.help
Subject: Re: Need help on GNU/GCC compiler for OS/2
Message-ID: <1993Mar4.221055.5945@njitgw.njit.edu>
Date: 4 Mar 93 22:10:55 GMT
References: <1993Mar4.044754.17560@math.ucla.edu>
Sender: news@njit.edu
Organization: New Jersey Institute of Technology, Newark, N.J.
Lines: 46
Nntp-Posting-Host: hertz.njit.edu