首页 > 解决方案 > MinGW 编译错误 - '__off64_t' 没有命名类型

问题描述

我刚刚在我的 Windows PC 上重新安装了 MinGW 和 Codelite IDE,但是我现在无法编译/构建项目。

这很奇怪,因为每次我更改设置或创建一个新项目时,我都能运行一次,然后它就停止工作了。

我已经尝试过重新安装 MinGW ...

在此处输入图像描述

标签: c++mingw

解决方案


这可能是在应用 c++11 或更新的标准时出现的 gcc 的错误,即添加参数“-std=c++11”或“-std=c++0x”。我通过在文件 stdio.h 中添加“#include “io.h”来修复它。

您可以转到包含路径:“c:/mingw/include”并编辑“stdio.h”。

/* * stdio.h * * Definitions of types and prototypes of functions for operations on * standard input and standard output streams. * * $Id: stdio.h,v 8863016e809f 2018/12/04 19:00:29 keith $ * * Written by Colin Peters * Copyright (C) 1997-2005, 2007-2010, 2014-2018, MinGW.org Project. * * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice, this permission notice, and the following * disclaimer shall be included in all copies or substantial portions of * the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER * DEALINGS IN THE SOFTWARE. * * NOTE: The file manipulation functions provided by Microsoft seem to * work with either slash (/) or backslash () as the directory separator; * (this is consistent with Microsoft's own documentation, on MSDN). * */ #include //include at here #ifndef _STDIO_H #pragma GCC system_header

/* When including <wchar.h>, some of the definitions and declarations
 * which are nominally provided in <stdio.h> must be duplicated.  Rather
 * than require duplicated maintenance effort, we provide for partial
 * inclusion of <stdio.h> by <wchar.h>; only when not included in
 * this partial fashion...
 */

如果有任何问题或更好的解决方案,我将非常高兴地感谢您的反馈。


推荐阅读