[comp.sys.mac.programmer] Simple Question on THINK C

scallon@cod.NOSC.MIL (Matthew C. Scallon) (12/12/90)

Hi Netters,

I have a simple question on Think C.  I'm new to Think C.  I wrote a simple 
program, no window management commands, no menu management commands, nothing.
The program compiled fine, but it didn't link, and the keywords above were
listed as "undefined."  How can I get them un-"undefined?"  I'd appreciate any
help.

Thanks,

Matt

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (12/16/90)

Matthew C. Scallon writes in a message to All

MCS> I wrote a simple 
MCS> program, no window management commands, no menu management commands, 
MCS> nothing. The program compiled fine, but it didn't link, and the 
MCS> keywords above were listed as "undefined." How can I get them 
MCS> un-"undefined?" I'd appreciate any help. 
MCS> Thanks, 
MCS> Mat

As far as I know, it is impossible to compile *any* Mac program that works 
with
the operating system that doesn't require the Window Manager, etc. This is 
because
all input/output to the screen is done via the QuickDraw toolbox routines in
ROM, and THESE assume that the various managers have been initialized (and 
therefore
the various <#includes> have been <#include>-ed). Your best bet is to get a
copy of the "Macintosh C Programming Primer," and step through it. ("Macintosh
 
Revealed" and "Inside Macinstosh" vol 1-4 would help also). You might also 
step
through the sample program "Hello World" that is included with the compiler,
and, of course, read the manual tutorial on how to create  simple programs 
using
"Hello World," Bullseye" and "MiniEdit" [chapters 3,4,5].

Lawson

 

 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org

hermens@groucho (12/18/90)

In article <32575.276B8C21@stjhmc.fidonet.org> Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) writes:
>Matthew C. Scallon writes in a message to All
>
>MCS> I wrote a simple 
>MCS> program, no window management commands, no menu management commands, 
>MCS> nothing. The program compiled fine, but it didn't link, and the 
>MCS> keywords above were listed as "undefined." How can I get them 
>MCS> un-"undefined?" I'd appreciate any help. 
>MCS> Thanks, 
>MCS> Mat
>
>As far as I know, it is impossible to compile *any* Mac program that works 
>with
>the operating system that doesn't require the Window Manager, etc. This is 
>because
>all input/output to the screen is done via the QuickDraw toolbox routines in
>ROM, and THESE assume that the various managers have been initialized (and 
>therefore
>the various <#includes> have been <#include>-ed). Your best bet is to get a
>copy of the "Macintosh C Programming Primer," and step through it. ("Macintosh
> 
>Revealed" and "Inside Macinstosh" vol 1-4 would help also). You might also 
>step
>through the sample program "Hello World" that is included with the compiler,
>and, of course, read the manual tutorial on how to create  simple programs 
>using
>"Hello World," Bullseye" and "MiniEdit" [chapters 3,4,5].
>
>Lawson
                  Or you can use the UNIX compatibility code that
                  puts a window on the screen that acts like a
                  simple UNIX terminal.  All I/O is UNIX-like and
                  simple commands like printf will work just fine.

Leonard


-- 
Leonard Hermens     hermens@ted.cs.uidaho.edu
Department of Computer Science
University of Idaho
Moscow, ID 83843

oster@well.sf.ca.us (David Phillip Oster) (12/20/90)

In article <1990Dec17.221555.16011@groucho> hermens@ted.cs.uidaho.edu (Leonard Hermens ) writes:
_>                  Or you can use the UNIX compatibility code that
_>                  puts a window on the screen that acts like a
_>                  simple UNIX terminal.  All I/O is UNIX-like and
_>                  simple commands like printf will work just fine.
_>
Leonard, I guess you didn't read the message you were replying to. The
unix compatibility package is implemented on top of the Window manager
and quickdraw, and you'll need to include the correct libraries to get the
program to link.

I've written Mac programs that vary in size from ~2M bytes down to 2bytes.
(The latter was an FKEY). For most programs, you need to include the appropriate
libraries, but if you program just uses ToolTraps, and your own O.S.Trap
glue it is certainly possible to write significant programs that use no
libraries. It is rarely worth it.
-- 
-- David Phillip Oster - At least the government doesn't make death worse.
-- oster@well.sf.ca.us = {backbone}!well!oster

cfejm@ux1.cts.eiu.edu (John Miller) (12/20/90)

In article <22264@well.sf.ca.us> oster@well.sf.ca.us (David Phillip Oster) writes:
>In article <1990Dec17.221555.16011@groucho> hermens@ted.cs.uidaho.edu (Leonard Hermens ) writes:
>_>                  Or you can use the UNIX compatibility code that
>_>                  puts a window on the screen that acts like a
>_>                  simple UNIX terminal.  All I/O is UNIX-like and
>_>                  simple commands like printf will work just fine.
>_>
>Leonard, I guess you didn't read the message you were replying to. The
>unix compatibility package is implemented on top of the Window manager
>and quickdraw, and you'll need to include the correct libraries to get the
>program to link.
>
>I've written Mac programs that vary in size from ~2M bytes down to 2bytes.
>(The latter was an FKEY). For most programs, you need to include the appropriate
>libraries, but if you program just uses ToolTraps, and your own O.S.Trap
>glue it is certainly possible to write significant programs that use no
>libraries. It is rarely worth it.
>-- 
>-- David Phillip Oster - At least the government doesn't make death worse.
>-- oster@well.sf.ca.us = {backbone}!well!oster

Well, if the idea is to do some simple processing on the Mac which doesn't
need to use the Mac interface, Leonard's suggestion is perfectly sound.
Another, perhaps easier way is to merely include the appropriate ANSI
library, do appropriate #includes (like stdio.h), and you're home free--
console window provided.  This kind of procedure is especially attractive
for down-and-dirty crunching without the typical Mac interface overhead.

John Miller
Music Theory
Eastern Illinois University
CFEJM@UX1.CTS.EIU.EDU

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (12/22/90)

hermens@groucho writes in a message to All

H>  Or you can use the UNIX compatibility code that  puts a window 
H> on the screen that acts like a  simple UNIX terminal. All I/O 
H> is UNIX-like and  simple commands like printf will work just 
H> fine. 
H> Leonard

The question arises: is he learning to program in C? Or is he learning to 
program
on the Mac using C? If the first, then you are right. If the second, then with
 
your strategy he's not learning anything new, and might as well buy a cheapo
clone and Turbo C for all the Mac-programming that he would learn.

Lawson
 

 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org