----- Original Message -----
From: "Gaijinco" <ga******@gmail.com>
Newsgroups: comp.lang.c++
Sent: Friday, April 13, 2007 3:24 PM
Subject: Re: Error compiling multiple file projects:
It appears that you're including the header twice somehow.
Should be enough to use
#ifndef FILE_H
#define FILE_H
#endif
to stop including the header more than once?
That will stop errors relating to multiple type definitions, but that's not
his problem. He's getting "multiple declaration" errors on global variables
defined in a header. If he fixes the error of the multiple declarations by
using include guards, then what will happen is that he'll get "variable
undefined" errors from the second and subsequent files attempting to use
those variables. The way to allow multiple compilation units to see a
global variable definition is to use the "extern" keyword in a header file,
and move the declaration/definition into an implementation file.
-Howard
(P.S., sorry for replying directly to you first; I'm still getting used to
this new newsreader.)