From: "Alex Vinokur" Newsgroups: comp.os.msdos.djgpp Subject: `mmap' undeclared Date: Thu, 26 Jun 2003 07:28:05 +0300 Lines: 90 Message-ID: NNTP-Posting-Host: 212.150.34.147 X-Trace: fu-berlin.de 1056601691 29102167 212.150.34.147 (16 [79865]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, ============================= Windows 2000 Intel(R) Celeron(R) CPU 1.70. GHz DJGPP 2.03 GNU gcc/gpp version 3.2.1 ============================= I try to compile the following program. File zzz.cpp --------- C++ code : BEGIN --------- #include #include #include #include #include #include #include #include using namespace std; void read_file (char* filename_i) { int fd = open(filename_i, O_RDONLY); assert (fd > 2); off_t sz = lseek(fd, 0, SEEK_END); char* ptr = (char*)mmap(0, sz, PROT_READ, 0, fd, 0); errno = 0; if (ptr != MAP_FAILED) { string str (ptr, ptr+sz); munmap (ptr, sz); } else { assert (ptr == MAP_FAILED); printf ("=== Error : %u %s ===\n", errno, strerror (errno)); } assert (ptr != MAP_FAILED); close(fd); } int main () { read_file ("zzz.txt"); return 0; } --------- C++ code : END ----------- --------- Compilation : BEGIN --------- $ gpp zzz.cpp zzz.cpp: In function `void read_file(char*)': zzz.cpp:17: `mmap' undeclared (first use this function) zzz.cpp:17: (Each undeclared identifier is reported only once for each function it appears in.) zzz.cpp:20: `MAP_FAILED' undeclared (first use this function) zzz.cpp:23: `munmap' undeclared (first use this function) --------- Compilation : END ----------- Note. Cygwin/gcc has no problem with compilation of that code. =========================================== Windows 2000 CYGWIN_NT-5.0 1.3.22(0.78/3/2) GNU gcc version 3.2 20020927 (prerelease) =========================================== What is wrong? Thanks, ========================================== Alex Vinokur mailto:alexvn AT connect DOT to http://www.simtel.net/pub/oth/19088.html http://sourceforge.net/users/alexvn ==========================================