Jump to content
  • Advertisement
Sign in to follow this  
Alpha Nox

Winsock tutorial problem with sample code

This topic is 4813 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

Hello, Someone recommended this winsock tutorial, but I can't compile the LISTENER sample code in it.( im using VS.NET 2003) The error is: MSVCRT.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup The tutorial is http://www.hal-pc.org/~johnnie2/winsock.html. Thanks very much for your help, Victor Freire

Share this post


Link to post
Share on other sites
Advertisement
What's happening is that you have made a Console program and are using int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow). The complier is looking for int main( int argc, char* argv[]).

To fix this simply add at the top of your .cpp file:
#pragma comment( linker, /entry:\"WinMainCRTStartup\"" ) and it should work fine.

Share this post


Link to post
Share on other sites
Quote:
Original post by Alpha Nox
Same error,


Whoops, looks like somehow a " got lost.

#pragma comment( linker, "/entry:\"WinMainCRTStartup\"" )

That works, I just tried it myself.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!