Hanita
Hanita

Reputation: 179

Multiple definition of main Error

when I compile my project, I get the following error.

error:Multiple definition of main() what is the problem?

Here is the code:

int main(int argc, char *argv[])
{
  QCoreApplication a(argc, argv);

myserver server;
server.startserver();

return a.exec();
}

Upvotes: 0

Views: 1399

Answers (1)

Ely
Ely

Reputation: 11162

That means in your program you have at least two functions named main. Search for main in your source files and eliminate one or more (by renaming/refactoring for example).

You can have only one function called main in a C/C++ program.

Upvotes: 5

Related Questions