Even though I am including <fcntl.h>
, I keep getting
'write' was not declared in this scope
'read' was not declared in this scope
'close' was not declared in this scope
even though the open()
function works just fine, and it compiles fine for x86.
I am following the instructions at [Howto] Cross compile using Eclipse and running Eclipse on a VM (oSX as host) with Ubuntu 12.04.
My Project Properties are:
CrossSettings, Path: tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin
Cross GCC Compiler, Command: arm-bcm2708hardfp-linux-gnueabi-gcc
Cross G++ Compiler, Command: arm-bcm2708hardfp-linux-gnueabi-g++
Cross G++ Linker, Command: arm-bcm2708hardfp-linux-gnueabi-g++
This is the simplified source that gives the error for the "close":
#include <iostream>
#include <fcntl.h>
using namespace std;
int fd;
int main() {
cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
close(fd);
return 0;
}
When I compile for x86 with gcc/g++ it works...
export PATH=$PATH:<pathtoyourcrosscompiler>
where <pathtoyourcrosscompiler> is full path to arm-bcm2708hardfp-linux-gnueabi-g++. Then try: `arm-bcm2708hardfp-linux-gnueabi-g++ -o /tmp/test <yoursourcefile>', where <yoursorucefile> is a path to the file containing your program. Paste the output here, please. Also please try to change your path to full path.