Hello! Есть код: //////////// a.hpp ////////////////// #ifndef __a__ #define __a__ class C { public: void foo(); }; void C::foo() { } #endif //////////// test.cpp ////////////////// #include "a.hpp" void bar() { C c; c.foo(); } //////////// main.cpp ////////////////// #include "a.hpp" int main() { C c; c.foo(); return 0; } //////////// Makefile ////////////////// all: test.o g++ main.cpp test.o test.o: g++ -c test.cpp clean: rm test.o a.out //////////////////////////////////////// При линковке получаю ошибки: g++ -c test.cpp g++ main.cpp test.o test.o: In function `C::foo()': test.cpp:(.text+0x0): multiple definition of `C::foo()' /tmp/ccMAE1jz.o:main.cpp:(.text+0x0): first defined here collect2: ld returned 1 exit status make: *** [all] Ошибка 1 Почему получается множественное определение? В чём принципиальное отличие от случая: //////////// a.hpp ////////////////// #ifndef __a__ #define __a__ class C { public: void foo() { } }; #endif //////////////////////////////////////// при котором всё линкуется нормально? Спасибо!