[gameprogrammer] Re: C-Code Error interpretation
- From: "Dave Slutzkin" <daveslutzkin@xxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Mon, 01 Aug 2005 11:43:28 +1000
On Sun, 31 Jul 2005 19:19:48 -0600, "Scott Harper" <lareon@xxxxxxxxxxx>
said:
> Sorry to bother, but I'm trying to get some code compiling so I can
> start working with it, but I'm running into some errors (two left
> now, actually) that I don't understand how to resolve.
>
> First off, there's "static declaration of 'variable_name' follows non-
> static declaration", and then it links back to both places it's
> declared:
>
> *.h -- extern int variable_name;
> *.c -- static int variable_name;
Static says to the linker 'no need to make this accessible outside this
file'. Extern says to the linker 'find this in another file'. As I
understand it, the linker should complain, because (I can't remember the
terminology exactly) the variable hasn't been declared with external
linkage, so other compilation units shouldn't be able to access it.
Does this make sense?
So I think the fix is to just get rid of the static from the
declaration. Obviously the Microsoft linker is slightly non-standard
here.
Hope that helps,
Dave.
--
Dave Slutzkin
Melbourne, Australia
daveslutzkin@xxxxxxxxxxx
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: C-Code Error interpretation
- From: Scott Harper
- References:
- [gameprogrammer] C-Code Error interpretation
- From: Scott Harper
Other related posts:
- » [gameprogrammer] C-Code Error interpretation
- » [gameprogrammer] Re: C-Code Error interpretation
- » [gameprogrammer] Re: C-Code Error interpretation
- » [gameprogrammer] Re: C-Code Error interpretation
- » [gameprogrammer] Re: C-Code Error interpretation
- [gameprogrammer] Re: C-Code Error interpretation
- From: Scott Harper
- [gameprogrammer] C-Code Error interpretation
- From: Scott Harper