Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » fatal error: entry point must be defined

This thread is locked; no one can reply to it. rss feed Print
fatal error: entry point must be defined
Mark Oates
Member #1,146
March 2001
avatar

I'm using MSVC 10, and trying to create a separate library that contains main() while the actual project program contains other functions. And I get that error "fatal error: entry point must be defined." Which I understand is because there is no main() in the project. I tried putting extern void main() into the project, but no success. I have 4 files:

The Lib

framework.h

extern void function1();
extern void function2();

extern void main();

framework.cpp

#include "framework.h"

void main()
{
  function1();
  function2();
}

The Program

main.cpp

#include "../framework/framework.h"

#include <iostream>

void function1()
{
  std::cout << "Hello World";
}
void function2()
{
  std::cin;
}

What's the best way to do this?

[edit:] Hrmkay, it appears that switching to the "Console (/SUBSYSTEM:CONSOLE)" has allowed the program to compile and run. I'm not sure why. This is under Program Properties > Configuration Properties > Linker > System > Subsystem.
It was previously blank.

bamccaig
Member #7,536
July 2006
avatar

Trent Gamblin
Member #261
April 2000
avatar

main should always return int, not void, but what bamccaig said is right. Windows applications look for WinMain not main. You might be surprised if you're used to using Allegro because it does some magic to hide that from you :).

Go to: