user10011764
user10011764

Reputation:

Can't find entry point

I wanted to create an new c++ project and start coding. I am working in an existing solution with 30+ projects in it. So instead of main() GwMain(..) is used. This works for all other files but not when I create a new c++ project. I get a linker error:

LNK2019 unresolved external symbol _main referenced in function "int__cdel invoke_main(void)" (?invoke_main@@YAHXZ)

File: MSVCRTD.lib(exe_main.obj)

The code is just like this:

#include <gwcore.hpp>
#include <gw.hpp>

int GwMain(int, char**)
{

    return 0;
}

Grit is used here a very old framework.

Upvotes: 0

Views: 1919

Answers (2)

Landstalker
Landstalker

Reputation: 1368

After checking all the compilation and linking options with other projects that work fine.

From your solution, select a project that works (and that uses GwMain). Right button-> property and check its dependencies in "common properties":

enter image description here

Do this manipulation on the other projects that work correctly (and that use GwMain) and try to see if there is a common dependency which allows them to use GwMain, then, try to add this dependency to your project that does not work

Upvotes: 0

Raviteja Narra
Raviteja Narra

Reputation: 456

Please check Project > Properties > General > Project Defaults > Configuration Type.

If this is ".exe" then a main is needed for this project. Else if this is ".dll" or ".lib" your code should compile.

Upvotes: 0

Related Questions