I made a new project with FIPv4Address ip(127, 0, 0, 1); line and tested it with include I mentioned and saw errors you showed. I poked around a little bit more and was able to come up with what may actually be a better solution for you.
Open your project’s Build.cs file and add "Networking" to public dependency module names.
Then add #include "Networking.h" to file where you are using networking code. This header file actually includes SocketSubsystem.h and IPv4Address.h, so you should be able to remove those includes. I believe you will still need to keep IPAddress.h include, but you can try removing that as well.
When I followed those steps, build errors related to IPv4Address cleared up.
I commented out code in IPv4Address.h file where those errors were located, and code compiled, ran, and fixed NavMesh updates during runtime.
I am attempting your method of fixing solution, but currently I had to give a long file extension for “Networking.h” file to be included. I also had to include “IPAddress.h” file to have it compile and run. I confirmed it is playing.
There error from kismeterror1.png is still showing FIPv4Address as unrecognized, but it still compiles and runs. I’m not sure how. I included another image of it.
I am going to try to build an .exe and see if it still works. I will keep you updated.
code is confirmed working, but I’m still getting error described in previous comment. I’m not sure how you can have something be undefined, but still compile and run.
constructor is setting up ip address, and variable is calling a function within a few lines after this.
I’m happy it is working, but this seems odd. If you have any feedback or suggestions, I would greatly appreciate it.
Is this throwing up a warning during build of project, or are you just seeing squiggle in code? If you are using Intellisense, it is not uncommon for it to show false-positive warnings with Unreal Engine 4 code. These warnings can generally be ignored since they will not prevent you from being able to build project.
I’m not sure what is happening there. Networking.h includes IPv4SubnetMask.h as well, so I am not sure why you are seeing errors relating to definition for that class. I tried to reproduce those errors, and was unable to do so. Do you think you might be able to create a new project from one of templates and add in some of your networking code until this error starts to appear? It looks like there is a problem with a header file somewhere, but I can’t track it down without being able to reproduce it.
I am a little confused by something with errors I’m receiving. In “IPv4Address.h” there are no intellisense errors, but when I attempt to build, it states that SubnetMask input used in operator functions is undefined. So, is “FIPv4SubnetMask” type not defined in “IPv4Address.h” file?
There are no #includes in file, so how would “IPv4Address.h” file recognize type? There are quite a few errors stating that it is assumed to be an int, but that it doesn’t support default int.
I also noticed that in “IPv4Subnet.h” it has errors in functions ‘ContainsAddress’ and ‘GetBroadcastAddress’ because it says “no operator found which takes a left-hand operand of type ‘FIPv4Address’ (or there is no acceptable conversion)”.
Anyways, if you have any ideas of what could be causing problem, please let me know. I am going to keep trying to get this to work. Thanks !
Also,
Inside class where I’m using networking code, I use #includes as follows:
////////////////// #include “SocketSubsystem.h” #include “IPv4Address.h” #include “IPAddress.h”
//////////////////
Everything compiles and runs fine. But, if I use:
////////////////// #include “Networking.h” #include “IPAddress.h”
//////////////////
It fails. Shouldn’t headers being included be set up exactly as previous #includes? Why does this matter? Networking.h includes “IPv4Address.h” and “SocketSubsystem.h” files as well.
It is true that many header files in UE4 are not very “well-behaved”, that is, they don’t #include or forward-declare things they need.
But Networking.h should be #including everything an order that prevents errors. What errors are you seeing when you use #include “Networking.h”?
If you need to use a long relative path in #include to get compiler to find file, that indicates that build system isn’t recognizing dependency on that module correctly. If “Networking” is in dependency list in your Build.cs file, I’m not sure what could cause this.
“assumed to be int” error is what Visual Studio normally outputs when it encounters an unknown type.
I added “Networking” dependency into Build.cs file, and I #include Networking.h, and IPAddress.h into file using them.
I clean it and attempt to build it, and I receive errors inside IPv4Address.h and IPv4Subnet.h files. I’ve attached an image (error6.png) of what errors are stating.
Now, if I #include SocketSubsystem.h, IPv4Address.h, and IPAddress.h, as was suggested previously, I only receive same errors in image, BUT not errors from IPv4Subnet.h.
Finally, if I go into IPv4Address.h, and remove following functions and code, it compiles and runs: