p_mork
06.05.2007, 20:59
Hallo,
ich hab mal wieder versucht, objektorientiert zu proggen. Leider klappt es nicht so wie es sollte. Beim folgendem Code bekomme ich 'ne Fehlermeldung:
class a
{
public:
virtual void mach()=0;
};
class b:public a
{
public:
void mach()
{
}
};
int main()
{
b x;
x.mach();
}
Und hier das Output vom Compiler:
> "make.exe" all
-------- begin --------
avr-gcc (GCC) 3.4.6
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling C++: main.cpp
avr-gcc -c -mmcu=atmega32 -I. -x c++ -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -fno-exceptions -Wall -Wa,-adhlns=obj/main.lst -MD -MP -MF .dep/main.o.d main.cpp -o obj/main.o
main.cpp:37: warning: alignment of 'b::_ZTV1b' is greater than maximum object file alignment. Using 1
main.cpp:31: warning: alignment of 'a::_ZTV1a' is greater than maximum object file alignment. Using 1
Linking: testpp.elf
avr-gcc -mmcu=atmega32 -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=obj/main.o -std=gnu99 -Wundef -MD -MP -MF .dep/testpp.elf.d obj/main.o --output testpp.elf -Wl,-Map=testpp.map,--cref -lm
obj/main.o:(.data+0xa): undefined reference to `__cxa_pure_virtual'
make.exe: *** [testpp.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:00
Weiss jemand, was diesmal nicht klappt???
MfG Mark
ich hab mal wieder versucht, objektorientiert zu proggen. Leider klappt es nicht so wie es sollte. Beim folgendem Code bekomme ich 'ne Fehlermeldung:
class a
{
public:
virtual void mach()=0;
};
class b:public a
{
public:
void mach()
{
}
};
int main()
{
b x;
x.mach();
}
Und hier das Output vom Compiler:
> "make.exe" all
-------- begin --------
avr-gcc (GCC) 3.4.6
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiling C++: main.cpp
avr-gcc -c -mmcu=atmega32 -I. -x c++ -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -fno-exceptions -Wall -Wa,-adhlns=obj/main.lst -MD -MP -MF .dep/main.o.d main.cpp -o obj/main.o
main.cpp:37: warning: alignment of 'b::_ZTV1b' is greater than maximum object file alignment. Using 1
main.cpp:31: warning: alignment of 'a::_ZTV1a' is greater than maximum object file alignment. Using 1
Linking: testpp.elf
avr-gcc -mmcu=atmega32 -I. -gdwarf-2 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=obj/main.o -std=gnu99 -Wundef -MD -MP -MF .dep/testpp.elf.d obj/main.o --output testpp.elf -Wl,-Map=testpp.map,--cref -lm
obj/main.o:(.data+0xa): undefined reference to `__cxa_pure_virtual'
make.exe: *** [testpp.elf] Error 1
> Process Exit Code: 2
> Time Taken: 00:00
Weiss jemand, was diesmal nicht klappt???
MfG Mark