www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/22/11:20:53

From: Andrew Crabtree <andrewc AT typhoon DOT rose DOT hp DOT com>
Message-Id: <199707221520.AA040834824@typhoon.rose.hp.com>
Subject: Re: error: undefined reference
To: ivanmdeb AT maltanet DOT net
Date: Tue, 22 Jul 1997 8:20:24 PDT
Cc: djgpp AT delorie DOT com
In-Reply-To: <33D4E451.6440@maltanet.net>; from "Ivan-Mark Debono" at Jul 22, 97 9:48 am

> 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.

--
_______       ___________________________________________________________
           /                       	                  Andrew Crabtree 
          /                          	      Workgroup Networks Division 
         ____       ___  /                                Hewlett-Packard 
        /     /    /    /   		                    Roseville, CA 
     __/   __/    _____/                                     916/785-1675
                 /                           andrewc AT rosemail DOT rose DOT hp DOT com
___________   __/   _____________________________________________________

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019