Skip to content

Fixed compile error. Added block to case label.#8

Open
Red-Portal wants to merge 1 commit intomartincohen:masterfrom
Red-Portal:patch-1
Open

Fixed compile error. Added block to case label.#8
Red-Portal wants to merge 1 commit intomartincohen:masterfrom
Red-Portal:patch-1

Conversation

@Red-Portal
Copy link

On mingw, a variable declaration in a case label needs to be in a separate block.

I added a block for the label.

-------------------------------------------------
- Compiler:      gcc
- Configuration: debug
- Runtime:       PUN_RUNTIME_WINDOWS
- Target C:      example-platformer
- Target RC:     example-platformer.rc
- Output:        bin\example-platformer.exe
-------------------------------------------------

Building resources...

Compiling...
Building debug...
In file included from ./lib/punity-tiled.h:139:0,
                 from example-platformer.c:19:
./lib/json.h: In function 'new_value':
./lib/json.h:258:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                   (state, values_size + ((unsigned long) value->object.values), 0)) )
                                          ^
In file included from example-platformer.c:19:0:
./lib/punity-tiled.h: In function 'tiled_load_meta_':
./lib/punity-tiled.h:272:9: error: a label can only be part of a statement and a declaration is not a statement
         Tile *tile = (Tile*)data;
         ^~~~

On mingw, a variable declaration in a case label needs to be in a separate block.

```shell
-------------------------------------------------
- Compiler:      gcc
- Configuration: debug
- Runtime:       PUN_RUNTIME_WINDOWS
- Target C:      example-platformer
- Target RC:     example-platformer.rc
- Output:        bin\example-platformer.exe
-------------------------------------------------

Building resources...

Compiling...
Building debug...
In file included from ./lib/punity-tiled.h:139:0,
                 from example-platformer.c:19:
./lib/json.h: In function 'new_value':
./lib/json.h:258:42: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
                   (state, values_size + ((unsigned long) value->object.values), 0)) )
                                          ^
In file included from example-platformer.c:19:0:
./lib/punity-tiled.h: In function 'tiled_load_meta_':
./lib/punity-tiled.h:272:9: error: a label can only be part of a statement and a declaration is not a statement
         Tile *tile = (Tile*)data;
         ^~~~
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant