[Coco] Question about compiling C in OS-9

Lothan lothan at newsguy.com
Tue Apr 13 10:28:39 EDT 2010


Looking at the c.prep output, your problem is that the entirety of your 
source file has been dropped. Starting with the line long ftell();, you 
should see:

long ftell();
#7
test1.c
test1_c
#5
1
#5
1

main(argc, argv)
{
 printf("testing");
}

Check the line endings in your source file (should be 0D, not 0A or 0D 0A) 
and make sure you don't have any extraneous control codes (nothing below 20 
other than 0D line endings) or extended ASCII codes (nothing above 7E). If 
you don't see anything obvious, comment out the include file to see if that 
makes a difference.

--------------------------------------------------
From: "Todd Wallace" <dragonbytes at cox.net>
Sent: Tuesday, April 13, 2010 1:41 AM
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Subject: Re: [Coco] Question about compiling C in OS-9

> Well, yes I verfied cstart.r and clib.l are in /dd/LIB. im not sure what 
> you mean about patched cc1. but when i tried the link with /d1 it failed 
> and says it cant be found.  Just to see, tried compiling your version of 
> the code in case maybe what you added was important. but still the same 
> unresolved reference error.  You asked about the output of c.prep so ill 
> paste it below. I dont understand what it means but maybe you might see 
> something wrong.  Perhaps my compiler dsk is not quite right.  Heres the 
> output of c.prep:
>
> {Term|02}/X1/SOURCES:c.prep test.c
> #7
> test.c
> test_c
> #P
> test_c
> 0
> #7
> /X1/DEFS/stdio.h
> stdio_h
> #5
> 0
> #5
> 2
> typedef struct _iobuf {
> char *_ptr,
> *_base,
> *_end;
> int _flag;
> int _fd;
> char _save;
> int _bufsiz;
> } FILE;
>
> extern FILE _iob[16];
>
> #5
> 25
>
> #5
> 29
>
> #5
> 33
>
> #5
> 35
>
> #5
> 43
>
> long ftell();
> #7
> test.c
> test_c
> #5
> 1
>
> On Apr 13, 2010, at 12:45 AM, Lothan wrote:
>
>> Have you verified that both cstart.r and clib.l are in /d1/LIB (or 
>> /dd/LIB if you have the patched cc1)? If it helps, I just compiled this 
>> code:
>>
>> #include <stdio.h>
>>
>> main(argc, argv)
>> int argc;
>> char **argv;
>> {
>>   printf("testing");
>> }
>>
>> by running "cc1 test.c" (without the quotes of course). This actually 
>> runs a shell script named c.com that executes the following:
>>
>> c.prep test.c >ctmp.3.m
>> c.pass1 ctmp.3.m -o=ctmp.3.i
>> del ctmp.3.m
>> c.pass2 ctmp.3.i -o=ctmp.3.a
>> del ctmp.3.i
>> c.opt ctmp.3.a ctmp.3.o
>> del ctmp.3.a
>> c.asm ctmp.3.o -o=ctmp.3.r
>> del ctmp.3.o
>> c.link /d1/lib/cstart.r ctmp.3.r -o=test -l=/d1/lib/clib.l
>> del ctmp.3.r
>>
>> As you can see, it links cstart.r and clib.l by default. If you're still 
>> getting the unresolved reference, run c.prep manually and list the file 
>> it generates to make sure main isn't getting mangled somehow.
>>
>> --------------------------------------------------
>> From: "Todd Wallace" <dragonbytes at cox.net>
>> Sent: Monday, April 12, 2010 6:42 PM
>> To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
>> Subject: [Coco] Question about compiling C in OS-9
>>
>>>
>>> Hey all,
>>>
>>> I'm trying to figure out how to use this microware C compiler for OS-9. 
>>> But I am stumped as to how to resolve this error.  If you aren't in to C 
>>> on OS-9, just disregard this.  Below is my little test program and the 
>>> output from the compiler.  If anyone could shed some light on what I'm 
>>> doing wrong, I'd appreciate it. Thanks :-)
>>>
>>> #include "/X1/DEFS/stdio.h"
>>>
>>> main(argc,argv)
>>> {
>>> printf"testing";
>>> }
>>>
>>> This is the output I get when trying to compile it:
>>>
>>> {Term|02}/X1/SOURCES:cc1 test.c
>>> CC1 VERSION RS 01.00.00
>>> COPYRIGHT 1983 MICROWARE
>>> REPRODUCED UNDER LICENSE
>>> TO TANDY
>>> 'test.c'
>>> c.prep:
>>> c.pass1:
>>> c.pass2:
>>> c.opt:
>>> c.asm:
>>> c.link:
>>> Unresolved references:
>>> main             cstart_a         in /dd/lib/cstart.r
>>> linker fatal: unresolved references
>>>
>>>
>>> - Todd Wallace
>>>
>>> --
>>> Coco mailing list
>>> Coco at maltedmedia.com
>>> http://five.pairlist.net/mailman/listinfo/coco
>>
>> --
>> Coco mailing list
>> Coco at maltedmedia.com
>> http://five.pairlist.net/mailman/listinfo/coco
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
> 



More information about the Coco mailing list