[.net] Problems with compiling this line of code

Started by
5 comments, last by dshipp82 18 years, 1 month ago
I'm trying to compile some code out of Programming Role Playing Games with DirectX 2nd Edition by Jim Adams, i've gotten everything else so far working fine for it except this line. virtual FAR PASCAL MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hWnd, uMsg, wParam, lParam); } Keep getting the standard error: f:\projects\tower\the tower\gamecore\core_system.h(44) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int I've tried fiddling around with this section of code a fair bit without success. Any help would be gratelly appreciated. Thanks.
Advertisement
You did not give the function a return type.
You have no return type for the function.

Dave
Window procedures have a return type of LRESULT, so you'll want this:

virtual LRESULT FAR PASCAL MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hWnd, uMsg, wParam, lParam); }

THank you very much too everyone that helped. Got it fully working. The only part i'm not happy with now before i've finished getting all this code to compile and doing major overhauls and modifications to it, is

the network core is playing up. I'm getting the following errors:

Core_Network.obj : error LNK2019: unresolved external symbol _inet_ntoa@4 referenced in function "public: int __thiscall cNetworkServer::GetIP(char *,unsigned long)" (?GetIP@cNetworkServer@@QAEHPADK@Z)
Core_Network.obj : error LNK2019: unresolved external symbol _WSACleanup@0 referenced in function "public: int __thiscall cNetworkServer::GetIP(char *,unsigned long)" (?GetIP@cNetworkServer@@QAEHPADK@Z)
Core_Network.obj : error LNK2019: unresolved external symbol _gethostbyname@4 referenced in function "public: int __thiscall cNetworkServer::GetIP(char *,unsigned long)" (?GetIP@cNetworkServer@@QAEHPADK@Z)
Core_Network.obj : error LNK2019: unresolved external symbol _gethostname@8 referenced in function "public: int __thiscall cNetworkServer::GetIP(char *,unsigned long)" (?GetIP@cNetworkServer@@QAEHPADK@Z)
Core_Network.obj : error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function "public: int __thiscall cNetworkServer::GetIP(char *,unsigned long)" (?GetIP@cNetworkServer@@QAEHPADK@Z)
.\Debug/Game.exe : fatal error LNK1120: 5 unresolved externals

All other cores are compiling correctly, this core is not necessary for the game i'm writing at the moment, but i'd like to support multi-playability by the end of the development. Anyone got any idea's on this, I THINK i've linked all the libraries necessary through the Project Options dialogue. I'm using VBNet 2005. Though I have nothing linked in the resources folder, only .h's in headers and .cpp's in source.

Thanks for any help.
Daniel
It looks like you need to add Ws2_32.lib to your list of input libraries.
Thanks Sicrane, that fixed it up. Now off to add in tons of stuff. Thanks everyone for all the help.

This topic is closed to new replies.

Advertisement