Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uwm.edu!src.honeywell.com!msi.umn.edu!cs.umn.edu!kksys!wd0gol!newave!john From: john@newave.UUCP (John A. Weeks III) Newsgroups: comp.sys.mac.programmer Subject: Re: Simple Think C question Message-ID: <669@newave.UUCP> Date: 26 Feb 91 01:29:32 GMT References: <0blpRGq00WB34DLlpM@andrew.cmu.edu> Reply-To: john@newave.mn.org (John A. Weeks III) Organization: NeWave Communications Ltd, Eden Prairie, MN Lines: 57 In article <0blpRGq00WB34DLlpM@andrew.cmu.edu> jp48+@andrew.cmu.edu (Jonathan Pace) writes: > I'm working my way through the "Macintosh C Programming Primer" and I've > bombed on the Hello, World #2 program. I get the error "invalid declaration" > when I precompile. The offending line seems to be: > WindowPtr gHelloWindow; I typed it in, and other than converting the rest of the program to Standard-C, it worked OK on Think C 4.0. Since it is short, try retyping the file. Otherwise, select the line before through the line after the offending line and delete it. Sometimes "hidden characters" can get into you file. At any rate, here is my file hello.c: ---CUT-HERE--- WindowPtr gHelloWindow; void ToolBoxInit( void ) { InitGraf( &thePort ); InitFonts(); FlushEvents( everyEvent, 0 ); InitWindows(); InitMenus(); TEInit(); InitDialogs( 0L ); InitCursor(); } void WindowInit( void ) { gHelloWindow = GetNewWindow( 400, 0L, -1L ); ShowWindow( gHelloWindow ); SetPort( gHelloWindow ); MoveTo( 30, 50 ); DrawString( "\pHello, World" ); } void main( void ) { ToolBoxInit(); WindowInit(); while( !Button() ) ; } ---CUT-HERE--- -john- -- =============================================================================== John A. Weeks III (612) 942-6969 john@newave.mn.org NeWave Communications ...uunet!rosevax!tcnet!wd0gol!newave!john ===============================================================================