'main' must return 'int'


Hello, I am Shivani Prasad and am new to CS50.

While compiling my program I am getting this mesage:

Compiling /home/ubuntu/workspace/pset1/hello.c …
clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wshadow hello.c -lcs50 -lm -o hello
hello.c:3:1: error: ‘main’ must return 'int’
void main()
1 error generated.
make: *** [hello] Error 1
Please be sure to stop other debuggers before continuing.

Looking forward to your help.


You need to use int main() instead of void main(). Also be sure that you return an integer value in the main function.


@abailiss I have done that. It’s still giving the same error.



Thanks for writing in. For code related issues, it is best to post on StackOverflow.com, however, if you think this is a Cloud9 related issue, do let us know and we’ll be happy to assist.

Regarding the issue above, the error shown should go away with @abailiss’s advice.