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"

[Closed] Trouble using windows includes with DWORD, INT..

Hello,

I'm trying to use a static library that use some includes files of windows sdk (winsock2.h) but I get compilation errors about ambiguous symbols: DWORD and INT. I searched in the documentation and those symbols appears to be, in unreal, typedef of "FUnusableClass".

Why prevent the use of those symbols? Maybe we are not supposed to use Windows stuff directly and must use Unreal's instead, like here?

What I'm trying to do is integrate a library we made, based on network library asio (http://think-async.com/Asio/), in our unreal project. So what can/should i do?

Nadège

Product Version: Not Selected
Tags:
more ▼

asked Apr 10 '14 at 12:23 PM in C++ Programming

avatar image

Nadege
64 3 4 11

avatar image gao10211 Sep 26 '14 at 08:53 AM

Where is the MyWindowsStuff.h file? I insert the above code but the compile error that "no such or directory about the MyWindowsStuff.h" apeears.

avatar image Ehamloptiran Sep 26 '14 at 09:21 AM

You dont actually include "MyWindowStuff.h" you substitute that for the headers that require windows platform types. So in your case the ffmpeg headers.

avatar image gao10211 Sep 26 '14 at 09:38 AM

Hi. Thanks for your answer. I insert ffmpeg headers like this, but errors not disppear.

 #include "AllowWindowsPlatformTypes.h" 
 #include "ffmpeginc.h" 
 #include "HideWindowsPlatformTypes.h"

there are follow souce code in ffmpeginc.h file

     #pragma once 

     #ifdef __cplusplus 
     extern "C" { 

     #include <libavutil/avutil.h> 
     #include <libavutil/imgutils.h> 
     #include <libavcodec/avcodec.h> 
     #include <libavformat/avformat.h> 
     #include <libswscale/swscale.h> 

     } 
     #endif

-this is the error 1>C:\Program Files (x86)\Windows Kits\8.1\include\shared\rpcasync.h(126): error C2872: 'UINT' : ambiguous symbol 1> could be 'C:\Program Files (x86)\Windows Kits\8.1\include\shared\minwindef.h(177) : unsigned int UINT' 1> or 'C:\Program Files\Unreal Engine\4.4\Engine\Source\Runtime\Core\Public\Core.h(491) : DoNotUseOldUE4Type::UINT' Please explain how can I fix it.

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

The question has been closed Dec 17 '15 at 07:53 PM by Doug E for the following reason:

The question is answered, right answer was accepted


2 answers: sort voted first

Where we need access to the Windows types in engine, we wrap the include in:

 #include "AllowWindowsPlatformTypes.h"
 #include "MyWindowsStuff.h"
 #include "HideWindowsPlatformTypes.h"
more ▼

answered Apr 10 '14 at 01:04 PM

avatar image

Jamie Dale STAFF
7.5k 177 67 305

avatar image Nadege Apr 10 '14 at 01:25 PM

nice thank you !

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

My Version....

In my static blueprint utilities class. Also I use 2 static buffers for the data gets.

in the .h

 UFUNCTION(BlueprintCallable, Category = TheVoidUtils)
     static FString GetMachineIP();


top of the .cpp

 #include "AllowWindowsPlatformTypes.h"
 #include "winsock.h"
 #include "HideWindowsPlatformTypes.h"

in the .cpp

 char VOIDIP_hostname[1024];
 char VOIDIP_IPSTRING[1024];
 
 FString UUnrealVoidUtils::GetMachineIP()
 {
 #ifdef WIN32
     WSADATA wsaData;
     WORD wVersionRequested = MAKEWORD(2, 0);
     if (::WSAStartup(wVersionRequested, &wsaData) != 0)
         return FString(TEXT("NO WINSOCK"));
 #endif
 
     if (gethostname(VOIDIP_hostname, sizeof(VOIDIP_hostname)) == SOCKET_ERROR)
     {
 #ifdef WIN32
         WSACleanup();
 #endif
         return FString(TEXT("WINSOCK ERROR"));
     }
     
     struct hostent *host = gethostbyname(VOIDIP_hostname);
     if (host == NULL)
     {
 #ifdef WIN32
         WSACleanup();
 #endif
         return FString(TEXT("GET HOST ERROR"));
     }
 
     sprintf(VOIDIP_IPSTRING, "%d.%d.%d.%d",
          (int32)(((struct in_addr *)(host->h_addr))->S_un.S_un_b.s_b1),
          (int32)(((struct in_addr *)(host->h_addr))->S_un.S_un_b.s_b2),
          (int32)(((struct in_addr *)(host->h_addr))->S_un.S_un_b.s_b3),
          (int32)(((struct in_addr *)(host->h_addr))->S_un.S_un_b.s_b4));
 #ifdef WIN32
     WSACleanup();
 #endif
 
     return FString(VOIDIP_IPSTRING);
 }
more ▼

answered Jul 07 '15 at 08:28 PM

avatar image

SND R Keene
968 31 120 113

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

Follow this question

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

Answers to this question