none
isomalloc.c(734) : error C2065: 'O_WRONLY' : undeclared identifier

    Question

  • Hi,

    Trying to port an application to compile with VC++. Am new to this environment though. Am getting the following errors while compiling.

    isomalloc.c(734) : error C2065: 'O_WRONLY' : undeclared identifier
    isomalloc.c(734) : error C2065: 'O_TRUNC' : undeclared identifier
    isomalloc.c(734) : error C2065: 'O_CREAT' : undeclared identifier
    isomalloc.c(734) : warning C4013: 'sleep' undefined; assuming extern returning i
    nt
    isomalloc.c(735) : warning C4013: 'write' undefined; assuming extern returning i
    nt
    isomalloc.c(737) : warning C4013: 'close' undefined; assuming extern returning i
    nt
    isomalloc.c(746) : error C2065: 'O_RDONLY' : undeclared identifier
    isomalloc.c(747) : warning C4013: 'read' undefined; assuming extern returning in
    t


    The corresponding lines of code are:


    sprintf(fname,".isomalloc.%d", CmiMyNode());
                while ((fd = open(fname, O_WRONLY|O_TRUNC|O_CREAT, 0644)) == -1) sleep(1); //This is line number 734
                write(fd, &s, sizeof(CmiUInt8));
                write(fd, &e, sizeof(CmiUInt8));
                close(fd);

                CmiBarrier();

                for (i=0; i<CmiNumNodes(); i++) {
                  CmiUInt8 ss, ee;
                  char fname[128];
                  if (i==CmiMyNode()) continue;
                  sprintf(fname,".isomalloc.%d", i);
                  while ((fd = open(fname, O_RDONLY)) == -1) sleep(1);
                  read(fd, &ss, sizeof(CmiUInt8));
                  read(fd, &ee, sizeof(CmiUInt8));
                  close(fd);
                  if (ss>s) s = ss;
                  if (ee<e) e = ee;
                }


    Help on this?
    Thanks.
    Wednesday, July 9, 2008 6:42 AM

Answers


  • Try adding the following lines to the beginning of the file:


    #include <io.h>

    #include <Fcntl.h>


    (or to StdAfx.h file, if there is one in your project). This should solve the problems, except the warning related to “sleep”.


    • Marked as answer by Karan Maroo Wednesday, July 9, 2008 8:27 AM
    • Marked as answer by Karan Maroo Wednesday, July 9, 2008 8:27 AM
    Wednesday, July 9, 2008 7:55 AM

All replies


  • Try adding the following lines to the beginning of the file:


    #include <io.h>

    #include <Fcntl.h>


    (or to StdAfx.h file, if there is one in your project). This should solve the problems, except the warning related to “sleep”.


    • Marked as answer by Karan Maroo Wednesday, July 9, 2008 8:27 AM
    • Marked as answer by Karan Maroo Wednesday, July 9, 2008 8:27 AM
    Wednesday, July 9, 2008 7:55 AM
  • That did it. Thanks a lot!
    Wednesday, July 9, 2008 8:23 AM