Advertisement

Multiple declaration errors...:( Still wont go away

Started by September 16, 2001 02:45 AM
2 comments, last by _Titan_ 23 years, 5 months ago
I knwo i''ve posted about this before, buit i still have problems. I have one header file that holds all global variables, and i inlcude it in all my .cpp files. Now, i set the #idndef #define #endif directives BUT i STILL gets errors! I managed to bypass them with /FORCE:MULTIPLE in my settings, but now they just come out as warnings. Why do i keep getting these warnings? I set the damn # directives in the header and all the code is inside the directives, so why would i still get a crap load of errors...er warnings? Everyone keeps saying, put the directives in, i have them in and it still dont work! What now?
(globals.h)

extern int a;
extern float b;

(globals.cpp)
#include''globals.h''
int a; // global scope
float b;

(fileX.cpp)
#include''globals.h''
..
..

(fileY.cpp)
#include''globals.h''
..
..




Advertisement
(globals.h)

extern int a;
extern float b;

(globals.cpp)
#include''globals.h''
int a; // global scope
float b;

(fileX.cpp)
#include''globals.h''
..
void func()
{
a=4;
}

(fileY.cpp)
#include''globals.h''

int func()
{
return a;
}







http://members.xoom.com/myBollux
Yipee! It worked. Thnx man. Now, i have a class defined in char_class.h

I fixed that pesky class problem too, thnx man! Much appriciated!

Edited by - _titan_ on September 16, 2001 4:45:53 AM

This topic is closed to new replies.

Advertisement