Jump to content
• Advertisement

Public Group

not using WinMain properly

This topic is 4955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright, I'm doing the DX tutorials that come with the DirectX SDK, and instead of a simple main function, I'm using WinMain, and I'm getting a linking error can't find symbol '_main'. So, I'm assuming that the WinMain function was supposed to be converted into a 'main' function somehow, and I haven't got it right, so it isn't.
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT )
{
// code
return 0;
}


Here it is. All I've got included is <d3d9.h> and that's it. I've tried including <windows.h>, but that hasn't made a difference. Any ideas that could help?

Share this post

Share on other sites
Advertisement
sounds like a linker error to me. What's your compiler/IDE?

Share this post

Share on other sites
A console project requires a main function. What you want is a win32 project. This is something you'll need to change in the project options. If you can't find the option, try creating a new win32 project and adding the files you want.

Share this post

Share on other sites
I'm using VC++ 6.

I don't know if its an error, because I've tried compiling the project that came with the DXSDK and it compiled fine, but the code for the main function looks exactly the same (not inside just the function name and return).

Do I have to declare that the project is a windows project?

Share this post

Share on other sites
you need it to be a win32 Project. Not a Win32 console project.

Also, make sure you are linking to the correct DX lib.

Share this post

Share on other sites
Thanks guys!

I started a new win32 project and just cut and paste all the code in and it worked.

:D
Appreciated

Share this post

Share on other sites

• Advertisement
• Advertisement

• Popular Contributors

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5
• Advertisement

• 14
• 12
• 9
• 12
• 37
• Forum Statistics

• Total Topics
631435
• Total Posts
3000056
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!