OBSApi and Windows headers

hauzer

New Member
OBSApi behaves wonky when including various Windows headers alongside it. Take the following examples:

Compiles
Code:
#include <OBSApi.h>
#include <Windows.h>

int main() { }

Doesn't compile
Code:
#include <Windows.h>
#include <OBSApi.h>

int main() { }

Doesn't compile
Code:
#include <sphelper.h>
#include <OBSApi.h>

int main() { }

Doesn't compile
Code:
#include <OBSApi.h>
#include <sphelper.h>

int main() { }

And so on. I'm not sure if the git version has this fixed (I don't have VS2013), but if it's not, it should be as soon as possible.
 
Last edited:

Lain

Forum Admin
Lain
Forum Moderator
Developer
Yes, you do have to include the headers in the correct order for OBS1. It works fine on git.
 

hauzer

New Member
Nope, just tried git. Upon further inspecting OBSApi.h, I think I've come up with a temporary solution:
Code:
#include <Windows.h>

#ifdef WINVER
#define WINVER_REAL WINVER
#undef WINVER
#endif
#ifdef _WIN32_WINNT
#define WIN32_WINNT_REAL _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#ifdef NTDDI_VERSION
#define NTDDI_VERSION_REAL NTDDI_VERSION
#undef NTDDI_VERSION
#endif
#ifndef _INC_COMMCTRL
#define _INC_COMMCTRL
#define INC_COMMCTRL_DO_UNDEF
#endif
#include <OBSApi.h>
#ifdef INC_COMMCTRL_DO_UNDEF
#undef _INC_COMMCTRL
#undef INC_COMMCTRL_DO_UNDEF
#endif
#ifdef NTDDI_VERSION_REAL
#undef NTDDI_VERSION
#define NTDDI_VERSION NTDDI_VERSION_REAL
#undef NTDDI_VERSION_REAL
#endif
#ifdef WIN32_WINNT_REAL
#undef _WIN32_WINNT
#define _WIN32_WINNT WIN32_WINNT_REAL
#undef WIN32_WINNT_REAL
#endif
#ifdef WINVER_REAL
#undef WINVER
#define WINVER WINVER_REAL
#undef WINVER_REAL
#endif


int main()
{

}

This indeed compiles.
 
Top