06-13-06 06:31 AM
key9 wrote:
> The strange is if I put the implement code to .h file directly , for
> example,
> on "LinuxTestTerminal.h"
> [key9@localhost unit]$ gcc -o test test.cpp -lstdc++
> /home/key9/tmp/ccgdxJIB.o(.text+0x1c2): In function `main':
> : undefined reference to `LinuxTestTerminal::printch(char*)'
> /home/key9/tmp/ccgdxJIB.o(.gnu.linkonce.t._ZN17LinuxTestTerminalC1Ev+0x19)
:
> In function `LinuxTestTerminal::LinuxTestTerminal()'
:
> : undefined reference to `vtable for LinuxTestTerminal'
> collect2: ld returned 1 exit status
> ********/LinuxTestTerminal.cpp/*********
> #include <stdio.h>
> #include "Terminal.h"
>
> void
> LinuxTestTerminal::printch(char* ch){
> printf("%c",*ch);
> }
You didn't tell the compiler about LinuxTestTerminal.cpp, so why should
it look there?
DS
[ Post a follow-up to this message ]
|