Can anyone tell me why I'm getting this error when trying to compile hello.c in the Terminal Window?

$ clang hello.c hello.c:7:1: error: expected identifier or '(' { ^ 1 error generated. $


1 Answer 1


Without seeing your code, no. But it's almost certain that you have a syntax error. Perhaps you put a semicolon on the end of the line int main(void), or something like that.

Take a close look at whatever code is just before the error.

  • Thank you! There was an error in the code. I'm not sure how it got there since it was just the pre-loaded code for the problem set...
    – Trvl4fun
    Sep 15, 2019 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .