From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: error: undefined reference Date: Wed, 23 Jul 1997 12:36:15 -0400 Organization: Cornell University Lines: 62 Sender: asu1 AT cornell DOT edu (Verified) Message-ID: <33D632FF.7578@cornell.edu> References: <199707221520 DOT AA040834824 AT typhoon DOT rose DOT hp DOT com> <33D6328E DOT 1EE3 AT maltanet DOT net> NNTP-Posting-Host: 128 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Ivan-Mark Debono wrote: > > I have renamed the TILE, SPRITE and MAP to .C files instead of .H > files. The compiler already has the -c directive, but now 2 other > errors occur: > Error: gcc.exe: bwmaped.o: linker input file unused since linking not > done > Error: gcc.exe: -lalleg: linker input file unused since linking not > done please do not hesitate to read files called README.1ST. it is actuually not an april fool's day joke. once you compile individual *.c files in to *.o files, you link them. i.e.: gcc -c one.c gcc -c other.c gcc -c another.c then gcc one.o other.o another.o -o myexe.exe -lalleg ok? -- Sinan > > Can anybody help??? > > Andrew Crabtree wrote: > > > > > I'm coding a map editor and I have decided to split my routines into > > > smaller files. This is the list of the current files: > > > > > > - BWMAPED.C (Main program) > > > - DATASTRT.H (Various constants and data structures) > > > - TILE.H (Tile routines) > > > - SPRITE.H (Sprite routines) > > > - MAP.H (Map routines) > > > bwmaped.c(101) Error: undefined reference to 'IMD_new_map' > > > > > > > As a general rule of thumb, only put the following in header files. > > > > Macros > > Defines > > Function Prototypes > > Struct declarations > > Externs > > > > Do NOT put in anything like this > > > > Variable Declaration > > Functions themselves. > > > > When splitting up files make multiple .c files, with corresponding > > .h files describing the interface if needed, to functions and variables. > > Compile the .c files with the -c option to stop at .o phase. Then, > > link them all together at once.