I'm using the full version of VS2013, and am trying to include atlbase into a class, along with sphelper, but I'm getting various types of errors.
I'm using a newly generated class, which will cleanly compile without these inclusions, and has pretty much nothing else inside of it.
The compiler is finding the libraries and seems to load them, but then I get around 20 errors that are all pretty much just like this (I omitted the rest, but they are all just like these ones)
1>E:\Programs\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE\atlcore.h(630): warning C4191: 'reinterpret_cast' : unsafe conversion from 'FARPROC' to 'BOOL (__cdecl *)(DWORD)'
1> Calling this function through the result pointer may cause your program to fail
1>E:\Programs\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE\atltransactionmanager.h(271): warning C4191: 'type cast' : unsafe conversion from 'FARPROC' to 'PFNCREATETRANSACTION'
1> Calling this function through the result pointer may cause your program to fail
1>E:\Programs\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE\atltransactionmanager.h(321): warning C4191: 'type cast' : unsafe conversion from 'FARPROC' to 'PFNCOMMITTRANSACTION'
1> Calling this function through the result pointer may cause your program to fail
1>E:\Programs\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE\atltransactionmanager.h(427): error C2039: 'DeleteFile' : is not a member of '`global namespace''
1>E:\Programs\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE\atltransactionmanager.h(448): warning C4191: 'type cast' : unsafe conversion from 'FARPROC' to 'PFNMOVEFILETRANSACTED'
1> Calling this function through the result pointer may cause your program to fail
1>E:\Programs\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE\atltransactionmanager.h(460): error C2039: 'MoveFile' : is not a member of '`global namespace''
1>E:\Programs\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE\atltransactionmanager.h(487): warning C4191: 'type cast' : unsafe conversion from 'FARPROC' to 'PFNGETFILEATTRIBUTESTRANSACTED'
1>E:\Programs\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE\atlbase.h(5766): warning C4191: 'type cast' : unsafe conversion from 'FARPROC' to 'LSTATUS (__cdecl *)(HKEY,LPCWSTR,REGSAM,DWORD)'
1> Calling this function through the result pointer may cause your program to fail
1>C:\Program Files (x86)\Windows Kits\8.1\include\um\sphelper.h(1333): warning C4191: 'type cast' : unsafe conversion from 'FARPROC' to 'LPFN_RegLoadMUIStringW'
1> Calling this function through the result pointer may cause your program to fail
These errors present themselves only after atlbase.h and/or sphelper.h are included. Half of them from the first, the other half from the second.
They are included as follows (beneath my project and class header inclusion):
#include <stdio.h>
#include <Windows.h>
#include "AllowWindowsPlatformTypes.h"
#include <atlbase.h>
#include "sphelper.h"
#include "HideWindowsPlatformTypes.h"
I have them within this 'platform types' block because the atlbase and sphelper libraries throw an obscene amount of errors each otherwise, pertaining to arbitrary declarations or something.
I have not edited the library files in any way, and completely deleted all of the libraries and reinstalled them from scratch.
It may be due to an oversight or something on my part, but can anyone explain why the atl and sphelper libraries won't include properly?
Edit:
To clarify, the solution to the problem in which I "resolved" that led to this problem, I found on "https://answers.unrealengine.com/questions/27560/trouble-using-windows-includes-with-dword-int.html"
I posted my problem on a more specific site, and got an answer there.
User Jamie Dale posted the following on UE4 AnswerHub
#include "AllowWindowsPlatformTypes.h"
#pragma warning(push)
#pragma warning(disable: 4191) // warning C4191: 'type cast' : unsafe conversion
#pragma warning(disable: 4996) // error C4996: 'GetVersionEx': was declared deprecated
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
// atltransactionmanager.h doesn't use the W equivalent functions, use this workaround
#ifndef DeleteFile
#define DeleteFile DeleteFileW
#endif
#ifndef MoveFile
#define MoveFile MoveFileW
#endif
#include <atlbase.h>
#undef DeleteFile
#undef MoveFile
#include <sphelper.h>
#pragma warning(pop)
#include "HideWindowsPlatformTypes.h"
This work around replaces the inclusions I used, and completely solved all of the problems I had. Full credit towards Jamie Dale on there.