Building ntcore with mingw

So I haven’t heard a response in this thread in a couple days now so I wanted to create a new thread.

My issue is that I can’t build the ntcore library so I can use it on a Windows system using mingw + cmake. I keep on getting these errors whenever I try to build with


I know I could try the visual studio compiler, but I need it to be built with mingw for 32 bit.

Another possibility is I could try to use UDP or TCP sockets. I much rather use network tables though.

I’m currently on my phone, and your Google docs isn’t opening. However, MinGW is not one of our supported platforms. We have precompiled versions available though. Look in either the c++ or java folders here You want the - desktop classifiers for either the c++ or java. For c++, extract the binaries from the zip and grab the Windows one for your architecture. For Java, the provided jar will run on Mac, Windows, and Linux.

Will try out. Sorry about it not opening. The reason is because it is a text file.

Next time use gist or pastebin. :slight_smile:

Also, I can’t read it either on my desktop, it wants me to download a 0-byte file. :-/

I decided to drop ntcore and just try to use a TCP socket. I want the robot to be the server and the ds to be the client. I’m using the winsock library on the Windows ds and my question was if this and this could be used for setting up a TCP socket stream with the DS. Or will I have to use regular linux socket calls. Is there any C++ examples using the WPILIB version? Also a concern of my is when I’m using the receive function will it stall the code until the server receives something?

The issue you’re running into with mingw32 is likely lack of support in mingw for std::mutex. See GitHub - meganz/mingw-std-threads: Standard threads implementation currently still missing on MinGW GCC on Windows for a possible solution (however, it will require editing a number of the ntcore source files). Alternatively if you can use mingw64, which may have the necessary support built in.

If you’re rolling your own, the two classes you’re referencing are actually part of ntcore, and while they’re present in the library and docs, headers aren’t installed for them at present (you can however copy the necessary headers from the ntcore source), and as they were actually intended for ntcore-internal usage, there’s no examples. These two classes are pretty basic wrappers around Linux socket calls. Yes, accept() and receive() are blocking calls (although you can specify a timeout for receive to make it semi-non-blocking), so you should put them in a separate thread.