mam kilka plikow *.cpp (1.cpp, 2.cpp, 3.cpp) i *.h (1.h, 2.h, 3.h).
1.cpp includuje 1.h i 2.h
2cpp. includuje 1.h 2.h 3.h
3.cpp includuje 3.h
Problem jest taki ze sie nie kompiluje:
/tmp/ccw6wVnw.o(.bss+0x0): multiple definition of Log' /tmp/ccfSSDEp.o(.bss+0x8): first defined here /tmp/ccNPUbBx.o(.bss+0x0): multiple definition of
gApp'
/tmp/ccfSSDEp.o(.bss+0x4): first defined here
/tmp/ccNPUbBx.o(.bss+0x8): multiple definition of Log' /tmp/ccfSSDEp.o(.bss+0x8): first defined here /tmp/ccJwoRAp.o(.bss+0x0): multiple definition of
Log'
/tmp/ccfSSDEp.o(.bss+0x8): first defined here
/tmp/ccKs4zoh.o(.bss+0x0): multiple definition of yDirs' /tmp/ccNPUbBx.o(.bss+0x4): first defined here /tmp/ccKs4zoh.o(.bss+0x8): multiple definition of
Log'
/tmp/ccfSSDEp.o(.bss+0x8): first defined here
/tmp/ccbNpwEo.o(.bss+0x0): multiple definition of wMain' /tmp/ccfSSDEp.o(.bss+0x0): first defined here /tmp/ccbNpwEo.o(.bss+0x4): multiple definition of
yDirs'
/tmp/ccNPUbBx.o(.bss+0x4): first defined here
/tmp/ccbNpwEo.o(.bss+0x8): multiple definition of yModules' /tmp/ccKs4zoh.o(.bss+0x4): first defined here /tmp/ccbNpwEo.o(.bss+0xc): multiple definition of
Log'
/tmp/ccfSSDEp.o(.bss+0x8): first defined here
collect2: ld returned 1 exit status
w plikach *.h deklarowalem:
static klasa * nazwa; - kompiluje sie ale nie dziala
klasa * nazwa; - linker sie czepia
extern klasa * nazwa; - tez nic
chcĘ tylko raz inicjowac klase (nazwa=new klasa()) i zeby byla widoczna wszedzie skad includuje odpowiedni plik naglowkowy. Moze ktos wie jak to zrobic ?