For anyone who ever used this book

Started by
17 comments, last by Fender148 23 years, 9 months ago
thanks Skitzo, right now my only errors are

\t3dlib1.cpp(160) : error C2664: ''CreateSurface'' : cannot convert parameter 1 from ''struct _DDSURFACEDESC2 *'' to ''struct _DDSURFACEDESC *''
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

and

t3dlib1.cpp(754) : error C2660: ''SetDisplayMode'' : function does not take 5 parameters

but it does
if you use his load_bitmap_file dont you need the flip and unload functions too? thanks for the help!

Advertisement
Im not too familiar with making my own libraries, so that might not be the best route for me, ?
Ah...the linker gives you an unresolved external because it can''t link the module (because it won''t compile with errors).The errors sound like its using a weird version of directx.Check the top of t3dlib1.cpp and make sure its including ddraw.h like this:

#include

and not doing something really dumb, like declaring the prototypes itself.This error:

\t3dlib1.cpp(160) : error C2664: ''CreateSurface'' : cannot convert parameter 1 from ''struct _DDSURFACEDESC2 *'' to ''struct _DDSURFACEDESC *''

is because the function is expecting a DDSURFACEDESC, not the newer DDSURFACEDESC2, or the other way around.At least one of the files is trying to do thing the old way, and the other way, which could possibly explain the 5 parameter error (but I though directx was backwards compatible as far as functions go).
----------meh
Argh...html

make sure its including ddraw like this:

    #include <ddraw.h>     


Edited by - Bulbasaur on July 16, 2000 2:16:46 AM
----------meh
that sounds good bulbasaur, but the t3dlib file does include ddraw.h, I even tried replacing the ddraw.h file in the vis studio includes with the directx one, so I cant figure out how to change the file so it doesnt use an old function like you suggest. Thanks (this stinks )

Well, rather then debug a ''library'' thats supposed to work when you get it, my advice (not that I''m good enough to give advice) to you is to ditch it and use DirectDraw without it; its not at all difficult to use...link ddraw.lib and use the various well-documented methods.
Sorry I couldn''t help

----------meh
Hey thanks for trying! I went to LaMothes web site (xgames3d.com) and there is a way to get a replacement cd that works, but I cant figure out how? so theres still hope
ok,
I have that disc, and ill try to help. I am creating an app right now. But if you want to get the Load_Bitmap_File function to work in the meantime heres some code for you to cut and paste.

In your project make a new header file and name it whatever you want. Im calling mine "utility.h". Now in your application make sure you say include "utility.h" or whatever you named it


heres the code
    //---utility.h---#ifndef _UTILITY_H_#define _UTILITY_H_// MACROS - DEFINES/////////////////////////////////////////////////#define BITMAP_ID 0x4D42#define DD_INIT_STRUCT(ddstruct) 		{ memset(&ddstruct,0,sizeof(ddstruct));          ddstruct.dwSize=sizeof(ddstruct);}// TYPES ///////////////////////////////////////////////////////////typedef unsigned short USHORT;typedef unsigned short WORD;typedef unsigned char  UCHAR;typedef unsigned char  BYTE;// STRUCTURES //////////////////////////////////////////////////////typedef struct BITMAP_FILE_TAG{	BITMAPFILEHEADER bitmapFileHeader;	BITMAPINFOHEADER bitmapInfoHeader;	PALETTEENTRY	 palette[256];	UCHAR			 *buffer;} BITMAP_FILE, *BITMAP_FILE_PTR;int Load_Bitmap_File(HWND hwnd,BITMAP_FILE_PTR bitmap, char* filename);/*load a bitmap off of disk into a BITMAP_FILE structure*/int Flip_Bitmap(UCHAR *image, int bytes_per_line, int height);/* this function is used to flip bottom-up .BMP images */int Scan_Image_Bitmap(BITMAP_FILE_PTR bitmap,                       LPDIRECTDRAWSURFACE7 lpdds);                      /* Load A bitmap onto a surface */								#endif    


//now make a new source file called "utility.cpp" and add the actual function definitions right from the book. The first line of utility.cpp will be to include "utility.h"

hope this helps

Edited by - skitzo_smurf on July 16, 2000 2:42:47 AM
"Innocent is just a nice way to say ignorant, and stupidity is ignorance with its clothes off."words of,skitzo_smurf
Well I can solve your problem in a few easy steps.

First open up visual c++.

Open up the workspace you were just trying to compile.

Now goto the TOOLS option.

Choose OPTIONS in that menu.

Select the DIRECTORIES tab on the list

Now you''ll notice that over in the box on the right hand side of the screen it says "INCLUDE FILES". (this will be needed for a later step).

Anyway. Add in your c:\mssdk\include\(or where ever you installed the SDK to) directory onto that list. Then highlight that directory and click on the up arrow icon until it''s at the top of the list.

Next you need to go up to the box where it says "INCLUDE FILES" click on that box, and choose "LIBRARY FILES".

Now add your c:\mssdk\lib\ (or where ever you installed the SDK to) directory onto that list. Highlight this, and hit the up arrow icon until it''s on the top of that list.

Now click OK and exit.

The last thing you need to do to get the project working correctly is the following.

Goto the PROJECT menu.

Select the SETTINGS option.

Choose the LINK tab.

goto the OBJECT/LIBRARY MODULES text box, and hit the END key.(this will take you to the end of the list).

Add in dxguid.lib (this is needed everytime you want to make a program which uses any part of direct x). And then add in any other libraries that direct x may use (Example: ddraw.lib, dsound.lib, dinput.lib).

Click OK.

Now compile your project with the REBUILD ALL option and it''ll execute if you did the above correct.

Joseph FernaldSoftware EngineerRed Storm Entertainment.------------------------The opinions expressed are that of the person postingand not that of Red Storm Entertainment.

This topic is closed to new replies.

Advertisement