20 Jul
2003
20 Jul
'03
12:19
Cincai Patron
Compilation: 1. "g++ -c Kelas.cpp" success. 2. "g++ -c coba.cpp" success. 3. "g++ -o haha coba.o Kelas.o -L." failed: coba.o(.text+0x18): In function `main': : undefined reference to `Kelas<int>::Kelas[in-charge]()' coba.o(.text+0x32): In function `main': : undefined reference to `Kelas<int>::getInt() const' collect2: ld returned 1 exit status
Forget what I wrote in my last mail, this is a far easier :) The linker links in one pass, so it has to see the definition of symbols before they're referenced. In your case, try linking like this: g++ -o haha Kelas.o coba.o and it should succeed :) Philipp