SFML community forums

Help => Network => Topic started by: rizaado on November 07, 2014, 12:43:40 pm

Title: undefined reference
Post by: rizaado on November 07, 2014, 12:43:40 pm
Hello. I  read the documentation(Connecting a TCP socket) and this is my code:

#include <SFML/Network.hpp>

using namespace std;

int main()
{
    sf::TcpSocket socket;
    sf::Socket::Status status = socket.connect("192.168.0.5", 53000);
    if (status != sf::Socket::Done)
    {
        // error...
    }
    return 0;
}
 

The Debug said:

||=== Build: Debug in chat (compiler: GNU GCC Compiler) ===|
obj\Debug\main.o||In function `main':|
C:\Users\Emil\Desktop\C++\chat\main.cpp|7|undefined reference to `_imp___ZN2sf9TcpSocketC1Ev'|
C:\Users\Emil\Desktop\C++\chat\main.cpp|8|undefined reference to `_imp___ZN2sf9IpAddressC1EPKc'|
C:\Users\Emil\Desktop\C++\chat\main.cpp|8|undefined reference to `_imp___ZN2sf4Time4ZeroE'|
C:\Users\Emil\Desktop\C++\chat\main.cpp|8|undefined reference to `_imp___ZN2sf9TcpSocket7connectERKNS_9IpAddressEtNS_4TimeE'|
obj\Debug\main.o||In function `ZN2sf9TcpSocketD1Ev':|
C:\SFML-2.1\include\SFML\Network\TcpSocket.hpp|46|undefined reference to `_imp___ZTVN2sf9TcpSocketE'|
C:\SFML-2.1\include\SFML\Network\TcpSocket.hpp|46|undefined reference to `_imp___ZN2sf6SocketD2Ev'|
||=== Build failed: 6 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

I have the newest version of codeblocks:codeblocks-13.12mingw-setup-TDM-GCC-481.exe

What can I do to run the code?
Title: Re: undefined reference
Post by: binary1248 on November 07, 2014, 12:51:06 pm
https://github.com/SFML/SFML/wiki/FAQ#what-and-how-do-i-link-to-use-sfml
https://github.com/SFML/SFML/wiki/FAQ#how-do-i-link-sfml-statically
Title: Re: undefined reference
Post by: rizaado on November 07, 2014, 01:30:06 pm
How can I repair this errors and use network in sfml without problems?
Title: Re: undefined reference
Post by: ChronicRat on November 17, 2014, 06:33:18 pm
How can I repair this errors and use network in sfml without problems?
https://github.com/SFML/SFML/wiki/FAQ#what-and-how-do-i-link-to-use-sfml
https://github.com/SFML/SFML/wiki/FAQ#how-do-i-link-sfml-statically