Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: ‘fileno’ was not declared in this scope

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.

like image 604
XNoize Avatar asked Oct 14 '25 10:10

XNoize


1 Answers

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

like image 160
deW1 Avatar answered Oct 16 '25 23:10

deW1