I've made sfml from source (a two month old version of 2.3) to work with MinGW 5.1.0 (with -std=c++14) with codeblocks on windows 8.1 and all network functions that I've tried work fine, except sf::IpAddress::toString(). This is my code:
#include <iostream>
#include <string>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(600,600), "Long distance pong");
sf::IpAddress address(sf::IpAddress::getLocalAddress());
std::cout<<address.toString()<<std::endl;
std::cin.get();
sf::TcpSocket socket;
//sf::Socket::Status = socket.connect("");
sf::sleep(sf::milliseconds(1000));
}
It keeps coming up with undefined reference to sf::IpAddress::toString[abi:cxx11]() const. I don't think it can be a problem with my linking as I've checked it loads of times, CMake didn't come up with any errors while I was building and no other errors or warnings are being produced (with -Wall on). Does anyone know why this one function isn't working?
I found that function in the repository and replaced my code (above) with this
#include <iostream>
#include <string>
#include <windows.h>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
int main()
{
sf::IpAddress address(sf::IpAddress::getLocalAddress());
in_addr addr;
addr.s_addr = address.toInteger();
std::cout<<inet_ntoa(addr)<<std::endl;
std::cin.get();
}
and it works, but I would prefer to use the SFML function.