Juan:
Gracias, tenés razón, compila y... linkea.
Lo que envié fue una reducción (incorrecta, parece) de mi problema real, donde
hay herencia múltiple involucrada.
Reenvio una reducción mejorcita, que compila pero no linkea
compilo con:
g++ -Wall -pedantic -pedantic-errors -O3 -DNDEBUG -ggdb -DDEBUG -fno-inline
-std=c++98 -c -o test.o test.cpp
linkeo con:
g++ test.o -o test
class Observer{
public:
Observer(){}
virtual ~Observer(){}
virtual void update(int i)=0;
virtual void update()=0;
};
class Output:public Observer {
public:
Output(){}
virtual ~Output(){}
virtual void update();
void update(int i){
update();
}
};
class STDOUT:public Output {
public:
STDOUT(){}
virtual ~STDOUT(){}
void update() {
//nop
}
};
int main(int argc, char argv[]) {
STDOUT stdout;
return 0;
}
salida del linkeo:
test.o: In function `Output':
test.cpp:12: undefined reference to `vtable for Output'
test.o: In function `~Output':
test.cpp:13: undefined reference to `vtable for Output'
test.o:(.rodata._ZTI6STDOUT[typeinfo for STDOUT]+0x10): undefined reference to
`typeinfo for Output'
collect2: ld returned 1 exit status
_______________________________________________
Lista de correo Programacion.
[email protected]
http://listas.fi.uba.ar/mailman/listinfo/programacion