c++11 - 如何使用带有-std = c++ 11标志的g++进行编译?

标签 c++11 compiler-errors

我正在尝试设置计算机(Windows 10)来编译c++11。我编写了一个简单的hello world程序,可以使用该程序进行编译g++ helloworld.cpp -o helloworld.exe -static-libgcc但是当我更改命令以允许这样的c++ 11时g++ helloworld.cpp -o helloworld.exe -static-libgcc -std=c++11我得到了意外的错误(对我来说)

In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cstdio:42:0,
                 from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\stdc++.h:46,
                 from helloworld.cpp:1:
c:\mingw\include\stdio.h:788:34: error: '__off64_t' does not name a type
 typedef union { __int64 __value; __off64_t __offset; } fpos_t;
                                  ^~~~~~~~~

至于背景信息,我使用g++ 6.3.0(至少这是我在cmd中键入g++ --veriosn后看到的内容)。
我应该怎么做才能解决这个问题? (能够编译)

最佳答案

我使用最粗鲁的方式,只是在#include "sys/types.h"中添加stdio.h

关于c++11 - 如何使用带有-std = c++ 11标志的g++进行编译?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53956659/

相关文章:

c++ - C++- “Multiple Definition of functions”如何解决?

C++11 正确的结构初始化

java - "table-layout"库(Toolkit 类)中的 Scala 无法满足的循环依赖

c++ - C++中的虚拟继承和统一初始化

c++ - Random_shuffle 可以在没有 <algorithm> 库的情况下运行吗?

JAVA BigInteger类错误: BigInteger: modulus not positive

objective-c - Objective-C ISO C++禁止声明无类型的X

compiler-errors - YACC错误 “is untyped”

c++ - 如何实现 "const"和 "non-const"重载而不重复代码?

c++ - 我可以合法地使用重载 operator() 的结构作为 std::upper_bound 的比较吗?