Largefile problem with gcc3.0.2

wilf@techco.ab.ca wilf@techco.ab.ca
Tue Oct 30 12:29:00 GMT 2001


Hi,

I've recently installed the latest release of the GNU compiler collection and
have discovered a rather nasty and mysterious problem.  Due to this, I've reverted
back to 2.95.3

I commonly access binary data files > 2 Gig's and have been enabling large
file support using -D_FILE_OFFSET_BITS=64.  I've found that if I add the
line #include <fstream> to a c++ source file, but mix this with a call to 
fopen, largefile support disappears (nm shows fopen being referenced in the
object rather than fopen64).  My operating system is Solaris 2.8.

The following reports an error when a 3 Gig file is opened:

  #include <stdio.h>
  #include <fstream>

  main()
  {
    FILE *fp = fopen("largefile.sgy", "rb");
    if(fp == NULL) perror("fopen");
  }


The following works just fine on the same 3 Gig file:

  #include <stdio.h>

  main()
  {
    FILE *fp = fopen("largefile.sgy", "rb");
    if(fp == NULL) perror("fopen");
  }

The compile line is: g++  -D_FILE_OFFSET_BITS=64 -o junk junk.c

Wilf Kruggel



More information about the Gcc-bugs mailing list