3
votes

I am running Cygwin on windows 8, attempting to compile the source code for a game I would like to mod. Unfortunately I am running into some errors while building involving the fileno function. After doing some googling It seems like the problem might have to do with c++11 support (I'm not really sure what this means). Most of the solutions people have found involve adding some option like -std=c++0x or -std=c++11 when compiling, but my attempts to add the options into the makefile have been unsuccessful, and I don't know if that's whats causing the problem anyways. I'll include the code snippet that's throwing the error and a link to the makefile as it is quite large. Any advice you could give me would be great.

code that throws error:

    time_t file_modtime(FILE *f)
    {
        struct stat filestat;
        if (fstat(fileno(f), &filestat))
            return 0;

        return filestat.st_mtime;
    }

Link to Makefile

it is being hosted on github

EDIT: After getting some advice I poked around the makefile and found five instances where the -std option was used, playing around with them hasn't changed anything. Is the problem with my Cygwin configuration? I installed the packages I was told I would need in the installation guide for the game I am building.

2
Have you #include <cstdio>?trojanfoe
yes <cstdio> is includedXNoize
I looked at that one before posting, and tried adding the options it suggested, but was unsuccessful. I was hoping for some advice on how to either work around it or where in the makefile the option needs to go.XNoize
Have you tried setting the standards to -std=gnu++0x ?marco

2 Answers

12
votes

Changing the -std=c*** in your makefile to -std=gnu++0x should fix your problem.

If you don't know what c++11 is you're most likely not using it anyway.

Also if you need c++11 support you can also do: -std=gnu++11 instead of -std=gnu++0x