Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Can't use sf::IpAddress::toString()  (Read 2194 times)

0 Members and 1 Guest are viewing this topic.

milodupipo

  • Newbie
  • *
  • Posts: 5
    • View Profile
Can't use sf::IpAddress::toString()
« on: January 11, 2017, 11:45:56 am »
Hi,

I'm trying to use  toString() in sf::ipAddress ubt I have this error :

undefined reference « sf::IpAddress::toString[abi:cxx11]() const »

I can use other methods like toInteger() from sf::IpAddress too. I think linkage is good.

Here what I'm trying to do :
#include<iostream>
#include<SFML/Network.hpp>
#include<SFML/System.hpp>

int main(){
    sf::IpAddress ad("192.168.1.98");
    std::string a = ad.toString();
    std::cout << "a : " << a << std::endl;
    return 0;
}
 

I have the same error when I'm trying to put and extract std::string into a sf::Packet :
#include<iostream>
#include<SFML/Network.hpp>
#include<SFML/System.hpp>

int main(){
    sf::Packet pa;
    std::string b = "hello";
    pa << b;
    b = "";
    if(pa >> b){
        std::cout << "string : " << b << std::endl;
    }
    return 0;
}
 
Undefined reference « sf::Packet::operator<<(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<ch
ar> > const&) »


And a part of the makefile :
CFLAGS=-Wall -Wno-unused-parameter -Wextra -ggdb -ansi -Wpedantic -std=c++11
LDFLAGS=-I/include/SFML/ -Llib -lsfml-network -lsfml-system
 

 
Could you help me to correct this please ?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Can't use sf::IpAddress::toString()
« Reply #1 on: January 11, 2017, 01:21:11 pm »
You need to rebuild SFML so that both end up using the same std::string ABI.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

milodupipo

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Can't use sf::IpAddress::toString()
« Reply #2 on: January 11, 2017, 04:16:31 pm »
That's working, thanks

 

anything