C and C++ program is not compiling on Angstrom OS
C Progam (board.c):
#include<stdio.h>
void main(){
printf("hello world");
}
Compiling C program on Angstrom Terminal
root@pldek-beagle:~/Comparison# gcc board.c -o board
/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
root@pldek-beagle:~/Comparison# gcc --sysroot=/usr/local board.c -o board
board.c:1:18: fatal error: stdio.h: No such file or directory
compilation terminated.
root@pldek-beagle:~/Comparison# whereis stdio
stdio: /usr/include/stdio.h
root@pldek-beagle:~/Comparison# echo $PATH
/mnt/data/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/include/c++/:/usr/include/:/usr/include/c++/:/usr/include/c++:/usr/include/c++/:/usr/include/c++/:/usr/include/c++/:/usr/include/:/usr/include
As you can see above , stdio.h path is available in $PATH even then the gcc is not able to find it.
C++ Progam (beagle.cpp):
using namespace std;
#include<iostream>
void main(){
cout<<"hello world";
}
Compiling C++ program on Angstrom Terminal
root@pldek-beagle:~/Comparison# g++ beagle.cpp -o beagle
/usr/lib/gcc/arm-angstrom-linux-gnueabi/4.7.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
root@pldek-beagle:~/Comparison# g++ --sysroot=/usr/local beagle.cpp -o beagle
beagle.cpp:2:19: fatal error: iostream: No such file or directory
compilation terminated.
root@pldek-beagle:~/Comparison# whereis iostream
iostream: /usr/include/c++/iostream
echo $PATH
/mnt/data/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/include/c++/:/usr/include/:/usr/include/c++/:/usr/include/c++:/usr/include/c++/:/usr/include/c++/:/usr/include/c++/:/usr/include/:/usr/include
As you can see above , iostream path is available in $PATH even then the g++ is not able to find it.