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

Author Topic: undefined reference  (Read 3552 times)

0 Members and 1 Guest are viewing this topic.

rizaado

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
undefined reference
« 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?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

rizaado

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: undefined reference
« Reply #2 on: November 07, 2014, 01:30:06 pm »
How can I repair this errors and use network in sfml without problems?
« Last Edit: November 08, 2014, 07:40:26 am by rizaado »


 

anything