I am cross compiling (host: x86 linux) for raspberry pi (ARM) using
arm-bcm2708hardfp-linux-gnueabi-g++
When I choose g++ it all works out fine and compiles.
But when cross compiling I get:
error: 'close' was not declared in this scope
This is the simplified source code
#include <iostream>
#include <fcntl.h>
using namespace std;
int fd;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
close(fd);
return 0;
}
Any idea? Did I forget to include smth? I am using eclipse as IDE.
I believe it’s as simple as this:
closeis declared in<unistd.h>, not<fcntl.h>. To find out what header file declares a symbol, you should always check the man pages first.