Wiki

Clone wiki

Open Steamworks / oswcppcompile

Getting VS2005 C++ to compile the OSW Headers

Hi guys,

Note: I am NOT using any Steam Libs (i.e. SteamApi.lib) and am logging into both Steam2 and Steam3 manually. Didrole advised me how to do this correctly.

To get MSVS 2005 C++ to compile the OSW headers, I have found that you only need to do 2 x things:-

1. Add these lines to you header file where you want to include the OSW Headers

#define		VERSION_SAFE_STEAM_API_INTERFACES
#define		STEAM_API_NON_VERSIONED_INTERFACES
#define		STEAMWORKS_CLIENT_INTERFACES
#define		WLB_WINSECURE
#include	<Open Steamworks\SteamWorks.h>

2. Modify the OSW header file SteamClient.h

//	SteamClient.h
// WLB	// steam_api
// WLB	#ifdef VERSION_SAFE_STEAM_API_INTERFACES
// WLB	#include "CSteamAPIContext.h"
// WLB	#endif // VERSION_SAFE_STEAM_API_INTERFACES

The headers will now compile with some whinging (please Didrole & VoiDeD consider adding some #define to overcome these kludges)

To stop the other whinging, I defined a new variable WLB_WINSECURE and used it as per the example below ...

inline void gameserveritem_t::SetName( const char *pName )
{
#	ifdef	WLB_WINSECURE
	strncpy_s( m_szServerName, sizeof( m_szServerName ), pName, sizeof( m_szServerName ) );
#	else	//ifdef	WLB_WINSECURE
	strncpy( m_szServerName, pName, sizeof( m_szServerName ) );
#	endif	//ifdef	WLB_WINSECURE
}

cheers OldFart

Updated