Volgende code geraakt wel gelinkt als C code, niet als C++ code:
C, commando en output:
C++ commando en output:
De cross compiler werkt, ik heb al enkele zaken zonder problemen gedraaid op het arm platform. De functie die hij niet vindt zit in khepera3.a. Ik heb al wat geprutst met extern maar dat hielp tot nu toe niet. Wat gaat er mis?
C, commando en output:
code:
1
2
3
4
5
6
| === Compiling main.o arm-angstrom-linux-gnueabi-gcc -Wall -I /home/bob/khepera3toolbox/Modules/khepera3 -I /home/bob/khepera3toolbox/Modules/i2cal -c main.c -o main.o main.c: In function ‘main’: main.c:5: warning: control reaches end of non-void function === Building ctest arm-angstrom-linux-gnueabi-gcc -o ctest main.o /home/bob/khepera3toolbox/Modules/khepera3/khepera3.a /home/bob/khepera3toolbox/Modules/i2cal/i2cal.a -lm -I /home/bob/khepera3toolbox/Modules/khepera3 -I /home/bob/khepera3toolbox/Modules/i2cal |
C:
1
2
3
4
5
| #include "khepera3.h" int main(int bl, char** bla){ khepera3_init(); } |
C++ commando en output:
code:
1
2
3
4
5
6
7
8
| === Compiling main.o arm-angstrom-linux-gnueabi-g++ -Wall -I /home/bob/khepera3toolbox/Modules/khepera3 -I /home/bob/khepera3toolbox/Modules/i2cal -c main.cpp -o main.o === Building ctest arm-angstrom-linux-gnueabi-g++ -o ctest main.o /home/bob/khepera3toolbox/Modules/khepera3/khepera3.a /home/bob/khepera3toolbox/Modules/i2cal/i2cal.a -lm -I /home/bob/khepera3toolbox/Modules/khepera3 -I /home/bob/khepera3toolbox/Modules/i2cal main.o: In function `main': main.cpp:(.text+0xc): undefined reference to `khepera3_init()' collect2: ld returned 1 exit status make: *** [ctest] Error 1 |
C++:
1
2
3
4
5
| #include "khepera3.h" int main(){ khepera3_init(); } |
De cross compiler werkt, ik heb al enkele zaken zonder problemen gedraaid op het arm platform. De functie die hij niet vindt zit in khepera3.a. Ik heb al wat geprutst met extern maar dat hielp tot nu toe niet. Wat gaat er mis?