[wellylug] C++ Programing Problem
Jethro Carr
dodocaptain at paradise.net.nz
Sun Sep 7 15:51:44 NZST 2003
On Sun, 2003-09-07 at 15:09, Stephen Judd wrote:
> But I think your real problem is this
>
> 2. Ensure globals in header files are defined with extern, thus:
>
> (in jgame2d.h)
>
> extern int keyboard_state; // this is now simply a declaration
>
> Otherwise, the jolly old compiler sees this:
>
> (in jgame2d.h)
> int keyboard_state; // declaring AND defining
>
> as the first definition, and will barf on the "second" one in your .cpp
> file.
Thanks, Stephen, it's all going now!
I thought it was something simple...
--- Jethro
dodocaptain at paradise.net.nz
homepages.paradise.net.nz/jethroc/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wellylug.org.nz/pipermail/wellylug/attachments/20030907/b0ec9c5d/attachment.htm
More information about the wellylug
mailing list