如何在Codeblocks10.05中进入C99模式? [英] How to get into C99 mode in Codeblocks10.05?

查看:122
本文介绍了如何在Codeblocks10.05中进入C99模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近意识到在收到编译错误后我甚至都不处于C99模式

I recently realized that I am not even in C99 mode after receiving the compile error


'for'循环只允许初始声明在C99模式下

'for' loop initial declarations are only allowed in C99 mode

我找到了一些有关如何通过快速搜索进入C99的建议,该建议告诉我去项目->属性... 但是,它变灰了,我不确定这是否是修复它的正确方法(可能不可用,因为我的文件不是项目,它是正常的源文件。 )。我也看到过很多类似的问题要启用C99模式,因此我查看了编译器标志菜单,但看不到任何有关C99的信息。我尝试了其他标志,例如在C模式下,支持所有ISO C90程序... ,但是在设置此标志后,我得到的错误比以前更多,而且似乎每当编译器出现时在main()中找到注释。

I found some advice on how to get to C99 via a quick search which has told me to go to Projects -> Properties... But alas, it is greyed out and I am not sure that is even the correct way to fix it (probably not available because my file is not a project, it is a normal source file). I have also seen a lot of similar questions saying to enable C99 mode so I have looked inside the compiler flags menu, but I cannot see anything about C99. I have tried some other flags such as In C Mode, support all ISO C90 programs..., but after I set this flag, I got more errors than I had before which seem to appear whenever the compiler finds comments inside main().

注意:请不要只是说要在for循环外初始化计数器。

Note: Please don't just say to initialize the counter outside the for loop.

更新:尝试使用gcc在代码块之外进行编译时,我尝试了
gcc -O2 -std = C99 filename.c ,但收到错误:

Update: While trying to compile outside of codeblocks with gcc, I tried gcc -O2 -std=C99 filename.c, but received an error:


无法识别的命令行选项 -std = C99

unrecognized command line option "-std=C99"

我使用64位Windows 7,CodeBlocks10.05和GNU gcc。

I use 64-bit Windows 7, CodeBlocks10.05, and GNU gcc.

推荐答案

以供将来参考,在 settings-> compiler->其他选项中键入标志 -std = c99 -敏感,但是在终端中编译时,该标志区分大小写。谢谢克里斯!

For future reference, type in the flag -std=c99 in settings->compiler->other options which is not case-sensitive, however when compiling in a terminal the flag is case-sensitive. Thanks chris!

这篇关于如何在Codeblocks10.05中进入C99模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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