Problem to Compiling Reality Factory with MVC++

Programming Reality Factory and Genesis3D.
Post Reply
nemis

Problem to Compiling Reality Factory with MVC++

Post by nemis » Fri Jul 15, 2005 2:24 pm

Compiling...
qxBinTriTree.cpp
C:\Programmi\Microsoft DirectX 9.0 SDK (December 2004)\Include\dsound.h(305) : error C2146: syntax error : missing ';' before identifier 'dwReserved1'
C:\Programmi\Microsoft DirectX 9.0 SDK (December 2004)\Include\dsound.h(305) : error C2501: 'DWORD_PTR' : missing storage-class or type specifiers
C:\Programmi\Microsoft DirectX 9.0 SDK (December 2004)\Include\dsound.h(305) : error C2501: 'dwReserved1' : missing storage-class or type specifiers
C:\Programmi\Microsoft DirectX 9.0 SDK (December 2004)\Include\dsound.h(306) : error C2146: syntax error : missing ';' before identifier 'dwReserved2'
C:\Programmi\Microsoft DirectX 9.0 SDK (December 2004)\Include\dsound.h(306) : error C2501: 'DWORD_PTR' : missing storage-class or type specifiers
C:\Programmi\Microsoft DirectX 9.0 SDK (December 2004)\Include\dsound.h(306) : error C2501: 'dwReserved2' : missing storage-class or type specifiers
C:\Programmi\Microsoft DirectX 9.0 SDK (December 2004)\Include\strmif.h(1024) : error C2146: syntax error : missing ';' before identifier 'HSEMAPHORE'
C:\Programmi\Microsoft DirectX 9.0 SDK (December 2004)\Include\strmif.h(1024) : fatal error C1004: unexpected end of file found

User avatar
AndyCR
Posts: 1449
Joined: Wed Jul 06, 2005 5:08 pm
Location: Colorado, USA
Contact:

Post by AndyCR » Fri Jul 15, 2005 2:51 pm

what version of msvc++ are you using?

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams » Fri Jul 15, 2005 3:21 pm

This is a compatibility problem. Since the summer update 2004 DirectX doesn't support the MSVC6++ compiler any longer.
This doesn't mean you can't compile the project, there are several steps you need to make:

1. Install the extras for the DX9 SDK
2. Now you get a new folder called "Extra" in you DirectX directory. There you will find the D3DX9.LIB. This file is compatible with Visual C++ 6, the default D3DX9.LIB is not. Rename the original D3DX9.LIB (e.g. DX9VC7.LIB) and copy the compatible library to this directory.
3. Copy the following code and save it as BASETSD.H, put it in the include folder of DirectX or MSVC:



Code: Select all

/*++ 

Copyright (c) Microsoft Corporation.  All rights reserved. 

Module Name: 

    basetsd.h 

Abstract: 

    Type definitions for the basic sized types. 

Author: 

Revision History: 

--*/ 

#ifndef _BASETSD_H_ 
#define _BASETSD_H_ 

#if _MSC_VER > 1000 
#pragma once 
#endif 

#ifdef __cplusplus 
extern "C" { 
#endif 

typedef signed char         INT8, *PINT8; 
typedef signed short        INT16, *PINT16; 
typedef signed int          INT32, *PINT32; 
typedef signed __int64      INT64, *PINT64; 
typedef unsigned char       UINT8, *PUINT8; 
typedef unsigned short      UINT16, *PUINT16; 
typedef unsigned int        UINT32, *PUINT32; 
typedef unsigned __int64    UINT64, *PUINT64; 

// 
// The following types are guaranteed to be signed and 32 bits wide. 
// 

typedef signed int LONG32, *PLONG32; 

// 
// The following types are guaranteed to be unsigned and 32 bits wide. 
// 

typedef unsigned int ULONG32, *PULONG32; 
typedef unsigned int DWORD32, *PDWORD32; 

#if !defined(_W64) 
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 
#define _W64 __w64 
#else 
#define _W64 
#endif 
#endif 

// 
// The INT_PTR is guaranteed to be the same size as a pointer.  Its 
// size with change with pointer size (32/64).  It should be used 
// anywhere that a pointer is cast to an integer type. UINT_PTR is 
// the unsigned variation. 
// 
// __int3264 is intrinsic to 64b MIDL but not to old MIDL or to C compiler. 
// 
#if ( 501 < __midl ) 

    typedef [public] __int3264 INT_PTR, *PINT_PTR; 
    typedef [public] unsigned __int3264 UINT_PTR, *PUINT_PTR; 

    typedef [public] __int3264 LONG_PTR, *PLONG_PTR; 
    typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR; 

#else  // midl64 
// old midl and C++ compiler 

#if defined(_WIN64) 
    typedef __int64 INT_PTR, *PINT_PTR; 
    typedef unsigned __int64 UINT_PTR, *PUINT_PTR; 

    typedef __int64 LONG_PTR, *PLONG_PTR; 
    typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; 

    #define __int3264   __int64 

#else 
    typedef _W64 int INT_PTR, *PINT_PTR; 
    typedef _W64 unsigned int UINT_PTR, *PUINT_PTR; 

    typedef _W64 long LONG_PTR, *PLONG_PTR; 
    typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR; 

    #define __int3264   __int32 

#endif 
#endif // midl64 

// 
// HALF_PTR is half the size of a pointer it intended for use with 
// within structures which contain a pointer and two small fields. 
// UHALF_PTR is the unsigned variation. 
// 

#ifdef _WIN64 

#define ADDRESS_TAG_BIT 0x40000000000UI64 

typedef __int64 SHANDLE_PTR; 
typedef unsigned __int64 HANDLE_PTR; 
typedef unsigned int UHALF_PTR, *PUHALF_PTR; 
typedef int HALF_PTR, *PHALF_PTR; 

#if !defined(__midl) 
__inline 
unsigned long 
HandleToULong( 
    const void *h 
    ) 
{ 
    return((unsigned long) (ULONG_PTR) h ); 
} 

__inline 
long 
HandleToLong( 
    const void *h 
    ) 
{ 
    return((long) (LONG_PTR) h ); 
} 

__inline 
void * 
ULongToHandle( 
    const unsigned long h 
    ) 
{ 
    return((void *) (UINT_PTR) h ); 
} 


__inline 
void * 
LongToHandle( 
    const long h 
    ) 
{ 
    return((void *) (INT_PTR) h ); 
} 


__inline 
unsigned long 
PtrToUlong( 
    const void  *p 
    ) 
{ 
    return((unsigned long) (ULONG_PTR) p ); 
} 

__inline 
unsigned int 
PtrToUint( 
    const void  *p 
    ) 
{ 
    return((unsigned int) (UINT_PTR) p ); 
} 

__inline 
unsigned short 
PtrToUshort( 
    const void  *p 
    ) 
{ 
    return((unsigned short) (unsigned long) (ULONG_PTR) p ); 
} 

__inline 
long 
PtrToLong( 
    const void  *p 
    ) 
{ 
    return((long) (LONG_PTR) p ); 
} 

__inline 
int 
PtrToInt( 
    const void  *p 
    ) 
{ 
    return((int) (INT_PTR) p ); 
} 

__inline 
short 
PtrToShort( 
    const void  *p 
    ) 
{ 
    return((short) (long) (LONG_PTR) p ); 
} 

__inline 
void * 
IntToPtr( 
    const int i 
    ) 
// Caution: IntToPtr() sign-extends the int value. 
{ 
    return( (void *)(INT_PTR)i ); 
} 

__inline 
void * 
UIntToPtr( 
    const unsigned int ui 
    ) 
// Caution: UIntToPtr() zero-extends the unsigned int value. 
{ 
    return( (void *)(UINT_PTR)ui ); 
} 

__inline 
void * 
LongToPtr( 
    const long l 
    ) 
// Caution: LongToPtr() sign-extends the long value. 
{ 
    return( (void *)(LONG_PTR)l ); 
} 

__inline 
void * 
ULongToPtr( 
    const unsigned long ul 
    ) 
// Caution: ULongToPtr() zero-extends the unsigned long value. 
{ 
    return( (void *)(ULONG_PTR)ul ); 
} 

#endif // !_midl 

#else  // !_WIN64 

#define ADDRESS_TAG_BIT 0x80000000UL 

typedef unsigned short UHALF_PTR, *PUHALF_PTR; 
typedef short HALF_PTR, *PHALF_PTR; 
typedef _W64 long SHANDLE_PTR; 
typedef _W64 unsigned long HANDLE_PTR; 

#define HandleToULong( h ) ((ULONG)(ULONG_PTR)(h) ) 
#define HandleToLong( h )  ((LONG)(LONG_PTR) (h) ) 
#define ULongToHandle( ul ) ((HANDLE)(ULONG_PTR) (ul) ) 
#define LongToHandle( h )   ((HANDLE)(LONG_PTR) (h) ) 
#define PtrToUlong( p ) ((ULONG)(ULONG_PTR) (p) ) 
#define PtrToLong( p )  ((LONG)(LONG_PTR) (p) ) 
#define PtrToUint( p ) ((UINT)(UINT_PTR) (p) ) 
#define PtrToInt( p )  ((INT)(INT_PTR) (p) ) 
#define PtrToUshort( p ) ((unsigned short)(ULONG_PTR)(p) ) 
#define PtrToShort( p )  ((short)(LONG_PTR)(p) ) 
#define IntToPtr( i )    ((VOID *)(INT_PTR)((int)i)) 
#define UIntToPtr( ui )  ((VOID *)(UINT_PTR)((unsigned int)ui)) 
#define LongToPtr( l )   ((VOID *)(LONG_PTR)((long)l)) 
#define ULongToPtr( ul ) ((VOID *)(ULONG_PTR)((unsigned long)ul)) 

#endif // !_WIN64 

#define HandleToUlong(h)  HandleToULong(h) 
#define UlongToHandle(ul) ULongToHandle(ul) 
#define UlongToPtr(ul) ULongToPtr(ul) 
#define UintToPtr(ui)  UIntToPtr(ui) 

#define MAXUINT_PTR  (~((UINT_PTR)0)) 
#define MAXINT_PTR   ((INT_PTR)(MAXUINT_PTR >> 1)) 
#define MININT_PTR   (~MAXINT_PTR) 

#define MAXULONG_PTR (~((ULONG_PTR)0)) 
#define MAXLONG_PTR  ((LONG_PTR)(MAXULONG_PTR >> 1)) 
#define MINLONG_PTR  (~MAXLONG_PTR) 

#define MAXUHALF_PTR ((UHALF_PTR)~0) 
#define MAXHALF_PTR  ((HALF_PTR)(MAXUHALF_PTR >> 1)) 
#define MINHALF_PTR  (~MAXHALF_PTR) 

// 
// SIZE_T used for counts or ranges which need to span the range of 
// of a pointer.  SSIZE_T is the signed variation. 
// 

typedef ULONG_PTR SIZE_T, *PSIZE_T; 
typedef LONG_PTR SSIZE_T, *PSSIZE_T; 

// 
// Add Windows flavor DWORD_PTR types 
// 

typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR; 

// 
// The following types are guaranteed to be signed and 64 bits wide. 
// 

typedef __int64 LONG64, *PLONG64; 


// 
// The following types are guaranteed to be unsigned and 64 bits wide. 
// 

typedef unsigned __int64 ULONG64, *PULONG64; 
typedef unsigned __int64 DWORD64, *PDWORD64; 

// 
// Thread affinity. 
// 

typedef ULONG_PTR KAFFINITY; 
typedef KAFFINITY *PKAFFINITY; 

#ifdef __cplusplus 
} 
#endif 

#endif // _BASETSD_H_ 


hike1
RF FAQ-Keeper
Posts: 607
Joined: Tue Jul 05, 2005 4:19 am
Contact:

Post by hike1 » Sat Jul 16, 2005 1:51 am

That's brutal! Is this the only way to compile RF? What about that NET thing, will that work?

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams » Sat Jul 16, 2005 12:44 pm

In fact this is pretty simple you just have to replace 1 file an add/replace a second one... nothing brutal here

hike1
RF FAQ-Keeper
Posts: 607
Joined: Tue Jul 05, 2005 4:19 am
Contact:

Post by hike1 » Wed Jul 20, 2005 5:58 pm

I got the 1.4MB dx 9 extras off microsoft.com, is there anything
else I need?

Gamespider
Posts: 51
Joined: Fri Jul 08, 2005 1:31 pm
Location: India

Post by Gamespider » Sun Jul 24, 2005 5:06 pm

Man! How did u manage to dload the directx 9.0 sdk? Its darn 227 mb :shock:

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams » Sun Jul 24, 2005 6:10 pm

I got the 1.4MB dx 9 extras off microsoft.com, is there anything
else I need?
if you already have the directx9 sdk it's all you need...

hike1
RF FAQ-Keeper
Posts: 607
Joined: Tue Jul 05, 2005 4:19 am
Contact:

Post by hike1 » Sun Jul 24, 2005 8:31 pm

if you already have the directx9 sdk

No, I don't and there's no way I'm DL'ing that,
you can't even use getright. How many megabytes of that do we actually need and can you upload them somewhere? PM me, I have room..

User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico » Sun Dec 11, 2005 7:26 pm

All works fine but I've got this errors:

Code: Select all

Linking...
   Creating library ..\Debug\RealityFactory.lib and object ..\Debug\RealityFactory.exp
Joystick.lib(joystick.obj) : error LNK2001: unresolved external symbol _IID_IDirectInput8A
..\Debug\RealityFactory.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

RealityFactory.exe - 2 error(s), 0 warning(s)
Any idea, QoD?

User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico » Sun Dec 11, 2005 8:32 pm

scuse me i found later the other topic. VC6 needs to have the DX9 path on the top of the inclusion hierarchy. Now compile without errors. :wink:

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams » Sun Dec 11, 2005 8:39 pm

Looks like it doesn't find the correct header or library
Make sure that the headers/libraries of the dx sdk are included first (there may be some old include files in the default visual c++ include directory)

[Edit]
:lol: looks like you found the solution while I was posting

User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico » Sun Dec 11, 2005 8:49 pm

yes, :lol: posting in the same time!
however I have still troubles. when I'll try to launch the compiled exe, it starts with an assert failure on line 22 in afxwin1.inl
Then RF starts but everything is slow and bad...
again: any idea? :D
Attachments
error.jpg
error.jpg (28.35 KiB) Viewed 3879 times

User avatar
federico
RF Dev Team
Posts: 443
Joined: Tue Jul 05, 2005 3:14 pm
Contact:

Post by federico » Sun Dec 11, 2005 9:07 pm

forget it .. I was running the debug version!

User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Post by QuestOfDreams » Sun Dec 11, 2005 9:37 pm

hmm, this error has something to do with AfxGetResourceHandle(), however I never got it before, press retry to debug and see where it comes from...
the debug version does run slow that's normal

Post Reply