错误:在此范围内未声明"fileno" [英] error: ‘fileno’ was not declared in this scope

查看:171
本文介绍了错误:在此范围内未声明"fileno"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 8上运行Cygwin,试图编译我想修改的游戏的源代码.不幸的是,在构建涉及fileno函数的过程中,我遇到了一些错误.进行一些谷歌搜索之后,似乎问题可能与c ++ 11支持有关(我不确定这意味着什么).人们发现的大多数解决方案都涉及在编译时添加一些选项,例如-std = c ++ 0x或-std = c ++ 11,但是我尝试将这些选项添加到makefile中的尝试失败,并且我不知道如果那是导致问题的原因.我将包含引发错误的代码片段和指向makefile的链接,因为它很大.您能给我的任何建议都是很棒的.

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.

引发错误的代码:

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

        return filestat.st_mtime;
    }

链接到Makefile

它被托管在github

it is being hosted on github

在获得一些建议后,我在makefile中进行了查找,发现使用-std选项的五个实例与它们一起玩并没有改变任何东西.我的Cygwin配置是否有问题?我安装了要制作的游戏的安装指南中告诉我的软件包.

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.

推荐答案

将makefile中的-std=c***更改为-std=gnu++0x应该可以解决您的问题.

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

如果您不知道c++11是什么,则很可能还是不使用它.

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

如果您需要c++11支持,也可以执行以下操作:-std=gnu++11而不是-std=gnu++0x

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

这篇关于错误:在此范围内未声明"fileno"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆