[SDL] error with 'multiple definition'

Lilith Calbridge lilith at dcccd.edu
Tue Feb 13 13:43:56 PST 2007


But he's trapped subsequent declarations.  On the first pass it checks to see if A_H is defined.  If not, it defines it.  The remainder is enclosed within the conditional.  On a second pass it should find that A_H is defined and thus will skip everything up to the #endif.  

The only other thing I can think of, except for the compiler not working properly, is that rem is declared somewhere else in the program.  

Lilith

>>> On 2/13/2007 at 3:38 PM, "Will Langford" <unfies at gmail.com> wrote:
> If more than one file #include's A.H, each one will attempt to declare
> std::string rem.  Fine during compiling, but when it comes time to link, the
> linker will see multiple things with the same name.
> 
> 
> On 2/13/07, nathayan de los valles <semiogro at hotmail.com> wrote:
>>
>> Hi all,
>> Perhaps this is not the best place to throw my doubt... but I have no
>> friends who can answer me.
>> I am using C++ and SDL.
>> I have several files .h like this:
>> A.h
>> #ifndef A_H
>> #define A_H
>> #include <iostream>
>> #include <sstream>
>> #include <string>
>> #include <fstream>
>> std::string rem = "//";
>> //more definitions
>> #endif
>>
>> B.h
>> #ifndef B_H
>> #define B_H
>> #include "A.h"
>> //definitions
>> #endif
>>
>> My compiler says me:   multiple definition of 'rem'. I think my compiler
>> doesn't run properly. Any idea?
>>
>> I use:
>> Dev C++ 4.9.9.2 (I know there is more interesting information but I don't
>> remember where to find it).
>> Thanks in advance.
>>
>> _________________________________________________________________
>> Horóscopo, tarot, numerología... Escucha lo que te dicen los astros.
>> http://astrocentro.msn.es/ 
>>
>> _______________________________________________
>> SDL mailing list
>> SDL at lists.libsdl.org 
>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org 
>>



More information about the SDL mailing list