且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Code :: Blocks中使用C11标准

更新时间:2021-12-10 23:16:51

由于默认情况下GCC 5.x版本与-std=gnu11一起运行,因此Code :: Blocks必须在做某些事情(例如传递-ansi)编译器以使其工作方式有所不同.

Since the GCC 5.x versions run with -std=gnu11 by default, Code::Blocks must be doing something (such as passing -ansi or -std=gnu90) to the compiler to make it work differently.

调查发送到编译器的所有选项.找到一种使Code :: Blocks向您显示其在编译时使用的确切方法的方法.然后找出解决方法.

Investigate all the options that are sent to the compiler. Find a way to have Code::Blocks show you the exact incantation it uses when compiling. Then work out how to fix it.

使用的选项是:

Options that are used are:

-Wall -Wextra -Werror -Wstrict-prototypes -Wconversion -std=gnu11 \
-O0 -g -ansi `pkg-config --cflags gtk+-3.0`

-ansi正在造成损坏;它等效于-std=c90-std=gnu90-显式撤消-std=c11-std=gnu11.

The -ansi is doing the damage; it is equivalent to -std=c90 or perhaps -std=gnu90 — it explicitly undoes -std=c11 or -std=gnu11.