www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/15/21:59:53

Sender: nate AT cartsys DOT com
Message-ID: <364F9396.F1C6BEE1@cartsys.com>
Date: Sun, 15 Nov 1998 18:53:10 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Library Creation
References: <72leem$1vs AT nnrp3 DOT farm DOT idt DOT net>
Reply-To: djgpp AT delorie DOT com

Chia wrote:
> 
> I've got a C++ GUI that I'm trying to turn into a library.  It uses allegro
> for keyboard and graphics support.
> 
> Now, how I've set this up is that I've got two files for each class, a
> header and an implementation.  Each file has
[deletia] 
> This produced a bunch of "first defined here / multiple definition" errors
> for each of the functions and some of the globals.

It might be helpful to look at what files the multiple definitions are
reported as coming from, and see what it is that it's complaining
about.  Is it possible some functions are defined multiple times?

Something else that often bites people is trying to put something like:

int foo = 42;

in a header.  This is a definition of the variable, and it can only have
one definition.  The correct way is to put the initialized definition in
one source file, and only a declaration (`extern int foo;') in the
header.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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