'SetPortW': is not a member of 'FInternetAddr'

255954-setport.png

Hi guys,

I’m trying to connect my socket by using FInternetAddr.
I followed this one A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums

but after build, I got this error: ‘SetPortW’: is not a member of ‘FInternetAddr’

I don’t understand why Visual Studio expands to ‘SetPortW’

anyone can help me out with this, thanks.

I think it is up to sequence to include.
In my case, including Windows.h before including SocketSubsystem.h I saw same issue.
So, I tried to make them correct sequence, Including SocketSubsystem.h early.
I solved that issue by Rearrangement.

good luck.

1 Like

Got this! Once I include the Networking.h (may be the same as socketsystem.h) before all headers, the error was solved!

如果你的项目中包含
include <windows.h>
其中定义了一些宏,会和Unreal定义的跨平台宏起冲突
这时你可以用Unreal中的
include “AllowWindowsPlatformTypes.h”
include <windows.h>
include “HideWindowsPlatformTypes.h”
这样一个形式将此包裹,就可以编译通过了