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

Author Topic: sf::IpAddress doesn't except a std::string. M2  (Read 886 times)

0 Members and 1 Guest are viewing this topic.

antinoid

  • Newbie
  • *
  • Posts: 8
    • View Profile
sf::IpAddress doesn't except a std::string. M2
« on: December 24, 2022, 02:30:45 am »
I recently got SFML working on my m2 MacBook and everything is fine except for sf::IpAddres, there isn't an option to pass in a string as an option.

Here's the error:
No matching constructor for initialization of 'sf::IpAddress'

The frameworks I used were the snapshot macos-clang-arm64.tar.gz, Date: 2022-Dec-22 16:39

I think that the snapshots might be the problem, but I'm not sure.

Btw here's the code I used:

#include <SFML/Network.hpp>

sf::TcpSocket socket;
void connect(std::string IPaddress){
    sf::IpAddress address(IPaddress);
}
 


Edit:
turns out I just needed to use sf::IpAddress::resolve(std::string); instead, problem solved :D.


« Last Edit: December 26, 2022, 01:55:41 pm by eXpl0it3r »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: sf::IpAddress doesn't except a std::string. M2
« Reply #1 on: December 26, 2022, 11:03:39 pm »
Yes, for SFML 3, which is currently being developed on the master branch, the API changed slightly.
If you want to keep using the SFML 2 API, you can get the snapshot of the 2.6.x branch as well.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/