x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Could I get some help with some problems with including atlbase in UE4?

Hey

I'm trying to include atlbase into a new ue4 project, but I get 2 different problems.

The first problem is that I get many errors telling me that various symbols are ambiguous, such as

 ws2def.h(245): error C2872: 'INT' : ambiguous symbol

The only solution I found for this problem, was to put the libraries that are causing these problems in a block of allow/hide windows playform types, such as

 #include <stdio.h>
 #include <Windows.h>

 #include "AllowWindowsPlatformTypes.h" 
 #include <atlbase.h>
 #include <sphelper.h>
 #include "HideWindowsPlatformTypes.h"

This solves the first problem, but then causes this second main problem to take place.

The above inclusions are what I'm currently using, but they give me numerous errors such as the following (I omitted some because a lot of them are redundant):

 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'

This then leads to my program failing to compile.

Does anyone know why this is happening? My aim is to include atlbase and sphelper as to gain access to the Windows Speech Recognition files, and everything was freshly installed and confirmed to work outside of UE4 based projects on the very same computer, using the same software.

I'm on Windows 7, 64 bit, running Visual Studio 2013 Ultimate. ,

Product Version: Not Selected
Tags:
more ▼

asked Jun 13 '14 at 07:24 PM in C++ Programming

avatar image

Yattabyte
6 2 3 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

We make use of atlbase.h in VisualStudioSourceCodeAccessor.cpp, but it seems we need to disable some warnings, and define some Windows functions in order to get it included without error.

The following should work:

 #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"
more ▼

answered Jun 13 '14 at 08:22 PM

avatar image

Jamie Dale STAFF
6.9k 175 60 295

avatar image Yattabyte Jun 13 '14 at 08:28 PM

Hahaha, yes! That solves the problem. Thank you so much!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question