Unix Programming - Re: Compile problem (simple,only 2 classes)

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > June 2006 > Re: Compile problem (simple,only 2 classes)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Compile problem (simple,only 2 classes)
davids@webmaster.com

2006-06-13, 1: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

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com