Code Error Problem

Started by
7 comments, last by Squeejee 22 years, 10 months ago
I get this error in VC++: c:FILE(105) : error C2440: ''='' : cannot convert from ''void *'' to ''struct HBRUSH__ *'' Conversion from ''void*'' to pointer to non-''void'' requires an explicit cast This is the code that is on that line: winclass.hbrBackground = GetStockObject(BLACK_BRUSH); Can someone help me with fixing this? If there is anymore info you need to know, tell me. ----------------------- Hail to the king, baby.
-----
Advertisement
yeh need to cast it to HBRUSH

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

in win32 they changed it so one function can get tons of stuff.
Thanks a lot!


-----------------------
Hail to the king, baby.
-----
I have a new prob now:

c:\FILE(44) : error C2146: syntax error : missing ';' before identifier 'lpdd4'

c:\FILE(44) : error C2501: 'LPDIRECTDRAW4' : missing storage-class or type specifiers

c:\FILE(44) : fatal error C1004: unexpected end of file found

This is on line 44:
LPDIRECTDRAW4 lpdd4 = NULL;

Yes, I have included ddraw.h.



Edited by - Squeejee on June 8, 2001 9:04:38 PM
-----
Have you linked ddraw.lib?

What the hells!
What the hells!
Your using that book by Andre Lamothe aren''t you? Go here for all your future problems. It''s right up your alley
If you have included ddraw.h then you have the wrong version. Visual C++ ships with DirectX 3 (IIRC).

Make sure that the line in The Options->Directories->Include tab has the directory with new DX headers listed before any "standard" include dirs.

The same goes for the directory containing the libs (on that other tab, "Libraries" or whatever it''s called, don''t quite remember).
How do I include the ddraw.lib? I added in #include ddraw.lib but it gives me this error:

c:\FILE(18) : fatal error C1083: Cannot open include file: 'ddraw.lib': No such file or directory

And I have set Options->Directories->Libary to poing to the DX8 sdk libary older.


-----------------------
Hail to the king, baby.

Edited by - Squeejee on June 9, 2001 9:28:22 AM
-----
tools->options->directories->include files

add the path of the include dir of the new SDK, and make sure it's at the top of the list , or MSVC will continue to use the old headers


tools->options->directories->library files
add the path to the lib dir of the new SDK


project->settings->link->object/library modules

add ddraw.lib dxguid.lib


Edited by - kvh on June 10, 2001 10:39:49 AM

This topic is closed to new replies.

Advertisement