0
#include <stdio.h>

int main()
{
    cout << "hello world";
    return 0;
}

I tried to compile this in Eclipse and it's giving me the error that there are "multiple definitions of main" and I am unable to run it... What should I do?

Nhan
  • 3,595
  • 6
  • 30
  • 38
ZoZo
  • 3
  • 1
  • 2
  • 2
    Are there other source files in the project that might contain a `main()`? – jonsca Apr 24 '11 at 08:50
  • 1
    Most probably you have more than one source file with `main()` in path - check how to define and use build configurations in **Eclipse** to switch `main()`s in http://stackoverflow.com/questions/18926630/multiple-definition-of-main-error-in-eclipse-using-c/40584300#40584300 – Martin Dvorak Nov 14 '16 at 08:31

1 Answers1

0

Check to see if there are other source files in your working directory - they may also have main methods in them.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Dennis
  • 3,962
  • 7
  • 26
  • 44