Hi
conssider the following files:
head1.h :
head1.cpp :Code:#ifndef HEAD1_H #define HEAD1_H struct test { int a; } structTest; #endif
main.cpp :Code:#include "head1.h" int func() { return structTest.a; }
my problem is, when i try to compile this program it gives me a multiple definition of structTest. How can i prevent this??Code:#include <iostream> #include "head1.h" int main() { std::cout <<structTest.a; }