I keep getting expected ';', identifier or '(' before 'void' void createCell(struct cell myCell, int type, int immutable)
I keep getting expected ';', identifier or '(' before 'void' void createCell(struct cell myCell, int type, int immutable)
So, I keep getting the compiler to tell me that there's an error before my first function declaration. Before this, I had defined an enum (before my first function), and then it was telling me the same error but right before the enum declaration.
error: "expected ';', identifier or '(' before 'void' void
createCell(struct cell myCell, int type, int immutable)"
#include <stdio.h>
#include "dungeon.h"
#define true 1
#define false 0
#define max_x 20
#define max_y 79
//why does it expect an identifier here?//
void createCell(struct cell myCell, int type, int immutable)
if(type == 0)
myCell.type = " ";
if(type == 1)
myCell.type = "#";
if(type == 2)
myCell.type = ".";
myCell.immutable = immutable;
void border_generator(struct cell cells[21][80])
int i, j;
for (i = 0; i < 21; i++)
for(j = 0; j < 80; j++)
void room_generator()
int main(int argc, char *argv)
struct cell cells[21][80];
border_generator(cells);
return 0;
dungeon.h
1 Answer
1
You have a struct or union definition not terminated by a semicolon (';') at the end of "dungeon.h".
It's easy to reproduce the very same error:
$ cat | cc -x c -
# 0 "dungeon.h"
struct foo int x;
# 3 "main.c"
void createCell(void)
^D
main.c:3:1: error: expected ‘;’, identifier or ‘(’ before ‘void’
Thanks! I am new to C, sorry.
– Gian Luca Spadafora
Sep 2 at 21:35
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Whats in
dungeon.h
?– tkausl
Sep 2 at 12:40