Date: Mon, 4 Dec 1995 11:46:29 -0800 (GMT) From: Orlando Andico To: THutchi141 AT aol DOT com Cc: DJGPP Mailing List Subject: Re: header file On Sun, 3 Dec 1995 THutchi141 AT aol DOT com wrote: > Hi, > > I am a new user of djgpp. I have downloaded several zip files and have > successfully > compiled several simple C programs. However, I have not been able to use the > include > file . A simple program, such as: > > #include > #include > > main() > { > printf("%d\n",sin(3.0)); > } > > produces an error: > > "ex2-2.c (.text + 0x24): undefined reference sin" > Hi! them ``undefined reference(s)'' are actually _link_ time errors. Id est, the _linker_ can't find the appropriate math library! (it's libm.a) In order to link in the math library, you have to type something like gcc ex2-2.c -lm ^^^ this part says to include the math library You don't need to worry about the ???68881.h file as that's the include file for the MC68881 maths coprocessor (used by Motorola cpu's, i.e. MC68020, that didn't have integral fpu's) Further, the math (floating-point) routines won't work if you don't have a coprocessor (if you have 486DX, 487SX or higher processor, you _do_ have the fpu). If you don't have an fpu (like me =( ) you must add the ff. line to your GO32 environment variable GO32=emu ... the rest of your stuff ... The standard emulator which comes with djeoe???.zip is emu387; you can find this in the /bin subdirectory. If you like (although this is moot if you have a coprocessor...) you can use another emulator that _used_ to be called emu387wm (it's in the wmemu112.zip file in the SimTel distrib). I think it's faster than the default emulator or something... Regards & good luck, ------------------------------------------------------------------------------- Orly A. Andico Instrumentation, Control, and Robotics Lab oandico AT gollum DOT eee DOT upd DOT edu DOT ph Dept of Electrical & Electronics Eng'g University of the Philippines Diliman -------------------------------------------------------------------------------