Path: chuka.playstation.co.uk!news From: "John Blackburne" Newsgroups: scea.yaroze.programming.codewarrior Subject: Re: Linking Problems (I think!) in CW Date: Tue, 09 Mar 1999 20:47:46 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 43 Message-ID: <7c41cq$cij4@chuka.playstation.co.uk> References: <7c3pmc$l2g19@chuka.playstation.co.uk> NNTP-Posting-Host: th-pm05-54.ndirect.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft Outlook Express Macintosh Edition - 4.5 (0410) ---------- In article <7c3pmc$l2g19@chuka.playstation.co.uk>, "Alan Marshall" wrote: > I'm having trouble converting a program which compiles fine under GNU, I.e. > no warnings or errors (!!!), yet in Codewarrior, I get > > Link Error : multiply-defined 'othWorld' in Init.c > Previously defined in Address.c > [...] > Address.c has > > #include > #include > #include "address.h" > > init.c has > > #include > #include "address.h" > #include "init.h" > > and the other .c files include the above .h files > This could happen if you include the wrong sorts of things in your header files. E.g. in shared headers global typedefs, defines, function prototypes and 'extern ...' variable defintions are fine and belong there. But (for example) a non-extern variable definition, or a non-prototype function definition, would cause problems as putting it in a header shared between two or more modules would cause it to appear in both, and so cause errors on linking. I would search through my source and headers and look where the symbol 'othWorld' appears. If you encounter problems like those above you should find a way to move the symbol into the correct object file, using 'extern...' in the headers so it can be accessed elsewhere. Repeat this for all problem symbols. If your still having problems try posting the relevant header files. John