Hallo, ich hab mal wieder versucht, objektorientiert zu proggen. Leider klappt es nicht so wie es sollte. Beim folgendem Code bekomme ich 'ne Fehlermeldung:
1 | class a |
2 | {
|
3 | public:
|
4 | virtual void mach()=0; |
5 | };
|
6 | |
7 | class b:public a |
8 | {
|
9 | public:
|
10 | void mach() |
11 | {
|
12 | }
|
13 | };
|
14 | |
15 | int main() |
16 | {
|
17 | b x; |
18 | x.mach(); |
19 | }
|
Und hier das Output vom Compiler:
1 | > "make.exe" all |
2 | |
3 | -------- begin -------- |
4 | avr-gcc (GCC) 3.4.6 |
5 | Copyright (C) 2006 Free Software Foundation, Inc. |
6 | This is free software; see the source for copying conditions. There is NO |
7 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
8 | |
9 | |
10 | Compiling C++: main.cpp |
11 | 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 |
12 | main.cpp:37: warning: alignment of 'b::_ZTV1b' is greater than maximum object file alignment. Using 1 |
13 | main.cpp:31: warning: alignment of 'a::_ZTV1a' is greater than maximum object file alignment. Using 1 |
14 | |
15 | Linking: testpp.elf |
16 | 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 |
17 | obj/main.o:(.data+0xa): undefined reference to `__cxa_pure_virtual' |
18 | make.exe: *** [testpp.elf] Error 1 |
19 | |
20 | > Process Exit Code: 2 |
21 | > Time Taken: 00:00[/code] |
Weiss jemand, was diesmal nicht klappt??? MfG Mark