Xref: utzoo comp.lang.c:36872 comp.sys.mac.programmer:22482 Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!news.cs.indiana.edu!att!cbfsb!cbnewsc!cbnews!jbr0 From: jbr0@cbnews.att.com (joseph.a.brownlee) Newsgroups: comp.lang.c,comp.sys.mac.programmer Subject: Re: ThinkC program--why wont it work? Message-ID: <1991Mar7.123946.13640@cbnews.att.com> Date: 7 Mar 91 12:39:46 GMT References: <91064.120155EAO102@psuvm.psu.edu> Sender: jbr@cblph.att.com Reply-To: jbr@cblph.att.com Organization: AT&T Bell Laboratories Lines: 55 In article <91064.120155EAO102@psuvm.psu.edu> EAO102@psuvm.psu.edu (Ernie Oporto) writes: > I have entered this program into Think C for compilation. It appeared in the > C Users Journal in the August 1990 issue. When I try to compile it, I get > "t_window ..." and "t_windinfo not defined". That's because they aren't defined. > What should I do. Define them. > [...] > >/*** text window creation function ***/ > >void create_t_window(title,wrect,closebox) >char *title; >Rect wrect; >int closebox; >{ >/* ... */ ^^^ See that? They are telling you they left stuff out. You need to define t_window and t_windinfo here. You can easily determine the types from the following code: > >/* allocate new window info */ > > t_windinfo = (WIND *)NewPtr(sizeof(WIND)); > >/* allocate new window */ > > t_window = NewWindow(NIL,&wrect,title,TRUE,8,FRONT,closebox,NIL); The correct definitions are: WIND * t_windinfo; WindowPtr t_window; Note also that by using "NIL" as your first argument, you are not allocating space to store the window record. This will often work, but you then risk heap problems. It is very easy to allocate the storage yourself; see Inside Macintosh I (Window Manager) for details. In general, I hate examples that leave out definitions. Novices are bound to be confused by stuff like this, and they're the ones most likely to be looking for examples. -- - _ Joe Brownlee, Analysts International Corp. @ AT&T Network Systems /_\ @ / ` 471 E Broad St, Suite 1610, Columbus, Ohio 43215 (614) 860-7461 / \ | \_, E-mail: jbr@cblph.att.com Who pays attention to what _I_ say? "Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk