• 13
• 12
• 9
• 10
• 13

# Build warnings... 'redefined'

This topic is 4584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm building my project using make and i am getting alot of warning saying that some of my defines are being redefined. Example: In file included from src/tmp2:13: src/../srcpp/Game_defs.hpp:163:1: warning "SOUND_FILE_A" is redefined src/../srcpp/Game_defs.hpp:147:1: warning this is the location of the previous definition I'm getting alot of these warnings. Are these being generated because i must be including the file twice somewhere or is it got to do with me #if & #elif checks?

#if( PLATFORM == JAVA )

#define SOUND_FILE_A				"a.mid"

#elif( PLATFORM == C )

#define SOUND_FILE_A				"a.mp3"

#endif


Thanks guys! [Edited by - Woody FX on September 2, 2005 3:29:15 AM]

##### Share on other sites
Yes, I think you have to #undef your macros in the beginning,
I think the macros get already defined from the last build.
It's when you compile the next time it is already defined then.
I was so for me when I compiled/build using #define macros.

Am I right or wrong?

##### Share on other sites
Make sure that you header file is not included twice. Each header file should have proper #ifndef/#define guards stopping this. Also make sure that all the contents of the header file are inside your #ifndef/#endif guards.

In any case, you probably want something like this

#ifndef SOUND_FILE_A    #if( PLATFORM == JAVA )        #define SOUND_FILE_A				"a.mid"    #elif( PLATFORM == C )        #define SOUND_FILE_A				"a.mp3"    #endif#endif

To make sure that SOUND_FILE_A is never redefined.
Also, make sure that PLATFORM really is defined as C or JAVA. You might want to add a

    #else        #undef SOUND_FILE_A

To catch such errors.