Path: news.daimi.aau.dk!poe From: Peter Andersen Newsgroups: comp.lang.beta Subject: Re: Constants in Beta Date: 26 Apr 1995 14:15:44 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 90 Approved: mailtonews@daimi.aau.dk Distribution: world Message-ID: <3nlkig$e0n@belfort.daimi.aau.dk> NNTP-Posting-Host: daimi.daimi.aau.dk Baiss E. Magnusson writes: > > > In following up on how to do constants in Beta, I looked at file > which looks like it does what I want. So I started > writing the following code shown below, which I put in file > ! > > However, it fails to build successfully ( as shown by the error at the > bottom), and in fact the same thing happens when I try to build > ! This is because you try to compile and link a library file. A program can only be linked when it binds the PROGRAM slot. This is like in C, where you can only link a program if it defines the "main" procedure. On UNIX a C compilation of a file not containing the "main" function will often result in an error like: ld: Undefined symbol _main unless you compile with the "-c" option. On the Mac, the MPW C compiler itself does not call the linker, so you wont get this type of errors from the C compiler on the mac. To solve you problem with the BETA compiler, you should invoke "beta" with the "-c" option: beta -c UI_DEFINES.bet BTW: The next version of the BETA compiler will not call the linker unless the PROGRAM slot is bound. > > What should the be, for this kind of file? If it only contains constants, it does not depend on any special patterns defined in any fragment. So you can just use '~beta/basiclib/v1.4/betaenv' for ORIGIN. > > Is this strategy correct? And if so what do I need to do to include this > fragment in all my source files? The best way would be to make a fragment called e.g. ApplEnv, which includes these definitions. Then make all your files have ORIGIN in ApplEnv. This will force a recompilation of all files if you change the constants. > > ******************* > ORIGIN '~beta/maclib/v2.8/maclib' > [[ > --- LIB : attributes --- > (# > PASTE_ID : (# exit 5 #); > CLEAR_ID : (# exit 6 #); > #); > ---]] > > ******************* > ... > Bind fragments in: 'UI_DEFINES'!Checking!Code generation.. > Resource macintosh > hd:applications:beta:beta3.0pe:basiclib:v1.4:private:external:betaenv_m > cbody.rsrc > Linking > ### Macintosh HD:Development:MPW Folder:tools:link: Error: Undefined > entry, name: (Error 28) "T1PROGRAM" > Referenced from: #1 in file: macintosh > hd:applications:beta:beta3.0pe:basiclib:v1.4:mac:betaenv.o > ### Macintosh HD:Development:MPW Folder:tools:link: Errors prevented > normal completion. > Sincerely, Peter Andersen _____________________________________________________________________________ Mjolner Informatics Aps Phone: (+45) 86 20 20 00 ext. 2753 Science Park Aarhus Direct: (+45) 86 20 20 11 - 2753 Gustav Wieds Vej 10 Fax: (+45) 86 20 12 22 DK-8000 Aarhus C, Denmark Email: peter.andersen@mjolner.dk _____________________________________________________________________________ BETA is better ----------------------------------------------------------------------------- PS. This is also explained in section 7.3 "Assembler and Linker Errors" in the BETA compiler reference manual (MIA90-02).