'main' must return 'int'


#1

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()
^~~~
int
1 error generated.
make: *** [hello] Error 1
Please be sure to stop other debuggers before continuing.

Looking forward to your help.


#2

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


#3

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


#4

Hi,

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.

Regards,
​Mutahhir