🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Problems with WGPFD

Started by
7 comments, last by Thalion_ 24 years, 4 months ago
I have some problems with the sourcecodes in the book Windows gameprogramming by Andre Lamothe. I try to compile(in Borland 5) the GPDUMB-engine with GPTEMP.cpp. I have added these to my project: GPTEMP.CPP GPDUMB1.CPP GPDUM1.H DDRAW.LIB DDRAW.H the .CPP files compile but when I try to compile the project I get this error: Fatal: UNable to open file gpdumb1.obj What have I done wrong?
Advertisement
When I try now the GPDUMB1.CPP wont compile, and I havnt changed anything...

It says:

Undifined Symbol ''index''
and
call to undifined function ''_lseek''
Keep in mind that the source from the book was written for Visual C++, not Borland. There will be some changes you need to make. For example, _lseek is probably lseek with Borland(no leading underscore - don''t quote me, it''s been a while since I used Borland). So you will need to understand the differences between Borland and VC++ and change the source accordingly.
Ok I tried it in Visial Studios Visial C++ 6.0.
I have added the directories of sdk/lib and sdk/include in the options.

Both GBDUMP1.CPP and GBTEMP.CPP now compiles.
But when I try to build the .EXE file I get these errors:

Linking...
Gpdumb1.obj : error LNK2001: unresolved external symbol _DirectDrawCreate@12
Debug/1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

1.exe - 2 error(s), 0 warning(s)

Why?
There must be lots people who have bought the book who knows how to fix it.
You say you included the /lib directory in your path, but did you actually add the necessary .libs to your project? You need to add ddraw.lib, dxguid.lib, and possibly others depending on which components you''re using. To add a lib, the preferred method is to go to Projects->Settings->Link, and add them to the list of .libs you''ll see there. Make sure to add them to both the debug and release modes.

- Dave
Did you include dxguid.lib? LaMothe mentions it ever so briefly, it took me a little while before I figured it out, I had to reread the introduction... anyway, if you hadn''t included that, that''s the source of your unresolved symbol errors.. as for the Borland compiler, I couldn''t help you.. I''m still having some troubles getting the BCB free command line tools to compile Win32 code..
Thank you very much now I can build it.
But there is still one problem:

Compiling...
Gptemp.cpp
E:\Familjen\Samuel\c++\gpdumb1\Gptemp.cpp(118) : error C2440: ''='' : cannot convert from ''void *'' to ''struct HBRUSH__ *''
Conversion from ''void*'' to pointer to non-''void'' requires an explicit cast
Error executing cl.exe.

Gptemp.obj - 1 error(s), 0 warning(s)

this, when I put // before that line it worked and I could build the EXE so that is ok now but of course the program wont work whitout that line.

I guess its something wrong with line 118:
winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
So you''re using VC++ 6.0 ..

You need to change the line :
winclass.hbrBackground = GetStockObject(BLACK_BRUSH);

to

winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

I guess.. I think he mentions that in his book as well.. you need to explicitly typecast the object (or something.. I''m not too up on tech terms =))

Hope this helps

Obu
Whoooaha!

It works!!!

Thank you all so very very much!

This topic is closed to new replies.

Advertisement