0

Hello all. I am making my first hello world program in C, and I have already run into issues.

#include <stdio.h>

int main()
{
printf( "Hello World\n" );
getchar();
return 0;
}

I am getting two errors when I try to run this.

C:\Users\Wiseguy\Documents\CodeBlocks\firstproject\firstproject.c|4|multiple definition of `main'|

and

obj\Debug\main.o:C:\Users\Wiseguy\Documents\CodeBlocks\firstproject\main.c|5|first defined here|

I feel stupid for posting this, but I am stuck. How do I correct these errors?

3
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by sergent
0

The error message sounds like you have more than one *.c file with main() in the project. Check your project and remove one of the files.

Edited by Ancient Dragon: n/a

0

There can be only one main() function in your whole program. It is the function that is called when your program starts executing. If there is more then one main functions delete it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.