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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gelberdaniel19

Pages: [1]
1
Network / Re: Linking error only against sfml-network on linux
« on: January 20, 2020, 04:59:00 am »
If anyone is curious, I fixed the issue by using static linkage from an older version. It seems to be an issue with the 2.5.1 build on the website for Linux.

2
Network / Linking error only against sfml-network on linux
« on: January 20, 2020, 01:58:58 am »
Hello! I am trying to build a server on Linux and I'm having issues. Everything links properly except some network functions. Here is my minimal example:
#include <SFML/Network.hpp>

int main() {
        sf::Http http("http://127.0.0.1", 8080);
}
 

The code compiles with no issues. When I use GCC to build it without linking, it gives the following output:
g++ main.o -o out
main.o: In function `main':
main.cpp:(.text+0x3e): undefined reference to `sf::Http::Http(std::string const&, unsigned short)'
main.o:(.rodata._ZTIN2sf9TcpSocketE[_ZTIN2sf9TcpSocketE]+0x10): undefined reference to `typeinfo for sf::Socket'
main.o: In function `sf::TcpSocket::~TcpSocket()':
main.cpp:(.text._ZN2sf9TcpSocketD2Ev[_ZN2sf9TcpSocketD5Ev]+0x30): undefined reference to `sf::Socket::~Socket()'
collect2: error: ld returned 1 exit status
 

You might think "well you must link against sfml-network." When I do that, it gives me the following:
g++ main.o -o out -lsfml-network -lsfml-system
main.o: In function `main':
main.cpp:(.text+0x3e): undefined reference to `sf::Http::Http(std::string const&, unsigned short)'
collect2: error: ld returned 1 exit status
 

As you can see, linking against network gives me less linker errors but still one. I have verified that the .so libraries exist in a place that g++ can find, so this makes me believe something might be wrong with the shared object. The same code runs with VC++ just fine.

The odd part is that I can compile and link the following code with no issues:
#include <SFML/Network.hpp>

int main() {
        sf::Packet pack;
        pack.clear();
}
 

That leaves me completely stumped as to why I can't link against sfml-network specifically for Http. If you have any ideas or request more info, let me know! Thank you for your help.

Pages: [1]
anything