I'm porting some software to Window from Unix and am using the g++ v4.7 on Windows XP SP3. I have a header file declaration that looks like this:
#include <string>
#include <sys/types.h>
using namespace std;
bool MakeDir(const string &dirName,
mode_t mode =S_IRWXU | S_IRWXG | S_IRWXO);
But when I compile it, I get this error:
FileName.h:35:40: error: 'S_IRWXG' was not declared in this scope
FileName.h:35:50: error: 'S_IRWXO' was not declared in this scope
Why would sys/types.h
define S_IRWXU
but not S_IRWXG
nor S_IRWXO
?
I found some code that defines them on Windows like this:
#define S_IRWXG (S_IRWXU >> 3)
#define S_IRWXO (S_IRWXG >> 3)
This seems like a kludge and apt to break, is there a better way to get definitions for these? I do not want to use Cygwin.
S_IRWXG and S_IRWXO are actual for Linux, on Windows you don't need them, values you can just get from Linux