Article View: comp.sys.mac.scitech
Article #20linking with GCC on the Mac?? Libraries?? Please Help!
From: Georg Schwarz
Date: Thu, 30 Jun 1994 06:04
Date: Thu, 30 Jun 1994 06:04
69 lines
3832 bytes
3832 bytes
I`d appreciate a lot if you could take the time to read the following
and perhaps even reply if you have an idea of what the problem might be:
I will have to develop some smaller C programmes (some hundreds of
lines of code at the most) to run on a UNIX workstation.
I thought that for my needs, GCC looked like a good choice to write and
perhaps test those programmes on my Macintosh, which is just a Performa
400 (16 MHz 68030, no FPU) 6/40. I am using System D1-7.1P.
The programmes I have to write will perform some calculations. They read
their input from a file and write their output to another one, so I do
not even need screen output, which of course would be nice, but probably
rather difficult to implement on the Mac due to the lack of a standard
text line based interface. Or are there any solutions available?
Not having the MPW, I obtained the standalone version of GCC found
at nic.switch.ch.
The most important problem I am facing right now is linking. It looks
like I do not understand the concept of suitcases.
For testing purposes, I have written the following little patch of
code:
#include <stdio.h>
void main(void)
{
FILE *fp;
if((fp=fopen("testfile","w"))!=NULL)
{
fputc((int)"a",fp);
fclose(fp);
}
}
which should create a file called "testfile" containing the character
"a".
Preprocessing, Compiling and Assembling went fine.
I have obtained the MPW headers and libraries from ftp.apple.com and
added the folders I keep them in in to the search path. Is that OK?
Now, when I try to link it, I get
Untitled.o: Undefined symbol _fopen referenced from text segment
Untitled.o: Undefined symbol _fputc referenced from text segment
Untitled.o: Undefined symbol _fclose referenced from text segment
What am I doing wrong??? (obviously these functions do not exist or
cannot be found?)
I made a second attempt, opening the stdio.suit suitcase that comes with
GCC before assembling. After assembling, I opened the DRVR entry in the
stdio.suit to find that my .o file had just been added in there. I then
selected all the entries in the DRVR window (maybe it would be better
just to select some entries, but I cannot select them except in a
contiguous range) and linked. I got dozens of errors like
wsetup.o: Undefined symbol _free referenced from text segment
vsscanf.o: Undefined symbol _strlen referenced from text segment
vfscanf.o: Undefined symbol __ctype_ referenced from text segment
just to quote the first ones. :-(((
How can I successfully link my programme???
Do I need the files from ftp.apple.com for that?
What are the files found in the archives gcc-1.37-includes.sit and
GCC_1.37.1r14_libsrc.sit which I also got from nic.switch.ch for?? Do I
need them for the sample programme above??
Any help would be greatly appreciated.
Thanks a lot!
(Yes, I did read all the help texts. Nevertheless, I do not have a clue
how to proceed.)
Technical Details
Message-ID:
<georg.772956277@lise>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!news.onramp.net!convex!cs.utexas.edu!howland.reston.ans.net!EU.net!Germany.EU.net!netmbx.de!zrz.TU-Berlin.DE!lise!georgShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1040c9,7eaad9c830605feb,start X-Google-Attributes: gid1040c9,public X-Google-Thread: 10b5e3,7eaad9c830605feb,start X-Google-Attributes: gid10b5e3,public X-Google-Thread: 104d1d,7eaad9c830605feb,start X-Google-Attributes: gid104d1d,public X-Google-ArrivalTime: 1994-06-29 23:19:46 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!news.onramp.net!convex!cs.utexas.edu!howland.reston.ans.net!EU.net!Germany.EU.net!netmbx.de!zrz.TU-Berlin.DE!lise!georg From: georg@lise.physik.tu-berlin.de (Georg Schwarz) Newsgroups: comp.sys.mac.scitech,comp.sys.mac.programmer,aus.computers.mac Subject: linking with GCC on the Mac?? Libraries?? Please Help! Date: 30 Jun 94 06:04:37 GMT Organization: Technical University Berlin, Germany Lines: 69 Message-ID: <georg.772956277@lise> NNTP-Posting-Host: lise.physik.tu-berlin.de Keywords: GCC