Jump to content
  • Advertisement
Sign in to follow this  
Nashoc3

Jim Adams Server/Client

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

Hey everyone. I'm a bit upset here. I've had problems with Jim Adam's code since I've bought his book. Im trying to compile the server and client but get the following errors: Build [C++ Warning] Core_System.h(50): W8058 Cannot create pre-compiled header: initialized data in header [C++ Error] WinMain.cpp(596): E2034 Cannot convert 'int (__stdcall *)(void *,unsigned int,unsigned int,long)' to 'int (__stdcall *)()' [C++ Error] WinMain.cpp(596): E2342 Type mismatch in parameter 'lpDialogFunc' (wanted 'int (__stdcall *)()', got 'int (__stdcall *)(void *,unsigned int,unsigned int,long)') [C++ Error] WinMain.cpp(646): E2243 Array allocated using 'new' may not have an initializer Ok, so I look at the code and notice... // Open connection dialog Result=DialogBox(GethInst(), MAKEINTRESOURCE(IDD_CONNECT), GethWnd(), ConnectDialogProc); Ok, so I figure the ConnectDialogProc); should be ConnectDialogProc(); nope.. Build [C++ Error] WinMain.cpp(687): E2219 Wrong number of arguments in call of macro 'DialogBoxA' [C++ Error] WinMain.cpp(687): E2451 Undefined symbol 'Dist' [C++ Error] WinMain.cpp(687): E2451 Undefined symbol 'Speed' [C++ Error] WinMain.cpp(691): E2451 Undefined symbol 'i' [C++ Error] WinMain.cpp(701): E2451 Undefined symbol 'XMove' [C++ Error] WinMain.cpp(702): E2451 Undefined symbol 'ZMove' [C++ Warning] WinMain.cpp(767): W8070 Function should return a value I tried building both the original code that came on cd AND his code after updating it, none of which work. Anyone else have problems compiling his code? I'm very dissapointed that I payed good money for something thats obviosly been broken for a LONG time.

Share this post


Link to post
Share on other sites
Advertisement

Hi Nashoc3

From looking at your output it looks like you are using a borland compiler, probably C++ Builder or such.

C++ Builder can handle some of the casts differently than how VC++ would. Not right or wrong just different....

The
Result=DialogBox(GethInst(), MAKEINTRESOURCE(IDD_CONNECT), GethWnd(), ConnectDialogProc);

is correct, however it looks to me like it's the handling of the ConnectDialogProc definition that is generating the
E2034 and E2342.

Since I don't have borland I can't tell you for sure what the problem is. A google search reveals similiar problems with different code bases.

I would start by changing the BOOL to LRESULT for the
BOOL CALLBACK ConfigDialogProc(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam)
To LRESULT CALLBACK ...

There's some sample code for a dialog box using borland here:
http://www.functionx.com/win32/Lesson04.htm
And more info here
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/dialogproc.asp

I'd verify I'm using the the latest platform SDK as well.

Failing this you might want to d/l VC C++ express (I'm able to build it with that 2nd edition code btw), it's free for now, but I can understand you'd rather get your prefered environment to work, this type of thing can be frustrating.

Good Luck,
- James






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!