• Unresolved external symbol error
    8 replies, posted
I tried to port my 3D engine into Visual Studio to make use of the fancy interface, but I get this error whenever I compile: [code]Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup MSVCRTD.lib(crtexew.obj) 3D Engine[/code] How can I fix this? I am using the Visual Studio 2010 beta.
You have to set up the project to compile as a Win32 program.
[QUOTE=Ortzinator;17990125]You have to set up the project to compile as a Win32 program.[/QUOTE] How? I have /SUBSYSTEM:WINDOWS in the linker properties, what else do I need to do? Edit: I managed to fix that but get a new error: [code]LINK : fatal error LNK1561: entry point must be defined[/code]
You didn't fix it. Before it couldn't find WinMain, the entry-point (main-function) for Win32 applications. And now you simply told the linker somehow, that this is not the entrypoint, but neither defined a new one. Don't you have an int main in your code?
[QUOTE=ZeekyHBomb;17991258]You didn't fix it. Before it couldn't find WinMain, the entry-point (main-function) for Win32 applications. And now you simply told the linker somehow, that this is not the entrypoint, but neither defined a new one. Don't you have an int main in your code?[/QUOTE] Yes, in my main.cpp. How do I tell it where to find it?
Try setting main in the advanced linker-options in your project. Strange it doesn't find it, since when I leave that empty it seems to just assume main, since this is the entry-point according to the standard.
[QUOTE=ZeekyHBomb;17991505]Try setting main in the advanced linker-options in your project. Strange it doesn't find it, since when I leave that empty it seems to just assume main, since this is the entry-point according to the standard.[/QUOTE] Now I get: [code]Error 1 error LNK2001: unresolved external symbol _main LINK 3D Engine[/code]
And you sure have main.cpp included in the project and not excluded from the build-process?
I used the create project from existing source code feature, and got it compiling (although it crashes immediately because a "vector subscript is out of range". Edit: I finally got it compiling and running fine!
Sorry, you need to Log In to post a reply to this thread.