How to use the C11 standard in Code :: Blocks

As in the title, I need to do code::blocksto work with C11, and I cannot figure out how to do this.

I went to settings=> compiler settings=> Other optionsand I added -std=c11and tried also with -std=gnu11, both do not work.

I compiled gcc-5.2and then I changed the default compiler (gcc-4.9) and did not get the result.


When I try to compile the following program:

#include<stdio.h>

int main(void){
    int arr[] = {0,1,2,3,4};

    for(int i=0;i<5;i++){
        printf("%d ",arr[i]);
    }

    return 0;
}

I get the following:

|6|error: β€˜for’ loop initial declarations are only allowed in C99 or C11 mode|

But if I do this in the terminal (ubuntu 15.04, 64BIT, gcc-5.2):

./install/gcc-5.2.0/bin/gcc5.2 program.c -o program

It seems to be working fine.

My question is: how to do code::blockswork with C11?

+3
source share
7

GCC 5.x -std=gnu11 , Code:: Blocks - (, -ansi -std=gnu90) , -.

, . , Code:: Blocks , . , .

:

-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.

+5

( - ), , ( ).

(, , - 12.2 - forc99.c Stephen Prata C Primer Plus)

code_blocks_16.01

β†’ β†’ ( ) β†’ β†’ β†’ . ( )

[ , -std = c99 ( , ), c99.]

(, gcc :: blocks 16.01 mingw 32bit, , 4.9.2)

+3

Codeblocks 13.12 Windows, GCC (4.7.1), C11.

  • Mingw 64 ( , Mingw32 GCC- C11).
  • . - , C:\Program Files\mingw-w64\x86_64-4.9.1-win32-seh-rt_v3-rev1\mingw64.
  • Codeblocks, Settings β†’ Compiler β†’ Toolchain β†’ . " ".
  • , C x86_64-w64-mingw32-gcc.exe ( GCC ) make mingw32-make.exe.
  • " " " ". "name" C11 -std=c11. "" C11, .
  • , C11, " , ISO C..." (- ). " " (-Wall).
+2

- > - > - > - > " g++ ++ 11 ISO", !!!

+1

CodeBlock. CodeBlock : 17.12.

:

  1. β†’ Copmpiler.
  2. " ": pop is openend.
  3. : "GNU GCC Compiler"
  4. " ".
  5. :
    • g++ C++ 11 ISO C++
    • GCC ISO C 2011
  6. .
  7. C++ 11.

, , .

0

, in for. , :

#include<stdio.h>

    int main(void)

        {
            int arr[] = {0,1,2,3,4};
            int i;
            for(i=0;i<5;i++){
                printf("%d ",arr[i]);
            }

            return 0;
        }

. :)

-2

"setting" β†’ "compiler", , "++ 11 ISO inc compiler".

enter image description here

-2

Source: https://habr.com/ru/post/1654560/


All Articles