errors LNK2019 and 1120

Started by
3 comments, last by Marcella 17 years, 11 months ago
Hello, im new to D3D programming in c++ and when making my first directX program (the second one from the orginal tutorials) I encountered a serious number of errors, but now I think im finnaly trough, I cant solve these two guys: Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup MSVCRTD.lib Error 2 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\World of Warcraft\Mijn documenten\Visual Studio 2005\Projects\tut22\Debug\tut22.exe 1 I'm using MVS 2005. and already included these libs: d3dx9.lib d3dxof.lib dxguid.lib DxErr9.lib d3d9.lib thanks, Marcella
/Marcella
Advertisement
mainCRT linker errors usually pertain to a problem with (or absence of) your main() function, or in windows' case, WINMAIN()
Quote:Original post by datadawgx
mainCRT linker errors usually pertain to a problem with (or absence of) your main() function, or in windows' case, WINMAIN()


Indeed, in this case the main() function is missing. But you probably don't want to write it, so you need to got to Project Menu->tut22 Properties->Configuration Properties->Linker->System->SubSystem and set it to Windows.


jfl.
In the propeties of your project, look in Linker->System->SubSystem. If this is set to 'Windows' you need to have a WinMain function that looks like this:

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )

If this is set to 'Console' you need a traditional Main function that looks like this:

int main(int argc, char *argv[])

If you have them the wrong way round (in your case possible a project that is set to console with no main function, only a WinMain). You will get link errors.
Quote:Original post by jflanglois
Quote:Original post by datadawgx
mainCRT linker errors usually pertain to a problem with (or absence of) your main() function, or in windows' case, WINMAIN()


Indeed, in this case the main() function is missing. But you probably don't want to write it, so you need to got to Project Menu->tut22 Properties->Configuration Properties->Linker->System->SubSystem and set it to Windows.


jfl.


It worked! Thanks alot.

/Marcella

/Marcella

This topic is closed to new replies.

Advertisement