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

Author Topic: Declaraion + Linking error  (Read 5119 times)

0 Members and 1 Guest are viewing this topic.

rahul8590

  • Newbie
  • *
  • Posts: 25
    • View Profile
Declaraion + Linking error
« on: April 18, 2010, 10:44:15 pm »
It may sound ridiculous , but i am getting errors while running the socket example programs like

cannot


 
Quote

H:\MySfml\sockets\main.cpp:68: error: `sf' has not been declared
H:\MySfml\sockets\main.cpp:68: error: `IPAddress' was not declared in this scope
H:\MySfml\sockets\main.cpp:68: error: expected `;' before "ServerAddress"
H:\MySfml\sockets\main.cpp:72: error: `ServerAddress' was not declared in this scope
H:\MySfml\sockets\main.cpp:72: warning: unused variable 'ServerAddress'
H:\MySfml\sockets\main.cpp:74: error: `ServerAddress' was not declared in this scope
H:\MySfml\sockets\main.cpp:77: error: `sf' has not been declared
H:\MySfml\sockets\main.cpp:77: error: `SocketTCP' was not declared in this scope
H:\MySfml\sockets\main.cpp:77: error: expected `;' before "Client"
H:\MySfml\sockets\main.cpp:80: error: `Client' was not declared in this scope
H:\MySfml\sockets\main.cpp:80: error: `sf' has not been declared
H:\MySfml\sockets\main.cpp:80: error: `Done' was not declared in this scope
H:\MySfml\sockets\main.cpp:80: warning: unused variable 'Client'
H:\MySfml\sockets\main.cpp:80: warning: unused variable 'Done'
H:\MySfml\sockets\main.cpp:87: error: `Client' was not declared in this scope
H:\MySfml\sockets\main.cpp:87: error: `sf' has not been declared
H:\MySfml\sockets\main.cpp:87: error: `Done' was not declared in this scope





well there are many and i do understand there is some small linking error .
i would be glad if u could help me out.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Declaraion + Linking error
« Reply #1 on: April 18, 2010, 11:28:05 pm »
It's not about linking, you probably just forgot to include <SFML/Network.hpp>.
Laurent Gomila - SFML developer

rahul8590

  • Newbie
  • *
  • Posts: 25
    • View Profile
Declaraion + Linking error
« Reply #2 on: April 19, 2010, 09:27:28 pm »
Well i have already included that , but still i do get error messages in here.

Quote

Linking console executable: bin\Debug\sockets.exe
obj\Debug\main.o: In function `main':
H:/MySfml/sockets/main.cpp:49: undefined reference to `DoServerTCP(unsigned short)'
obj\Debug\main.o: In function `Z11DoClientTCPt':
H:/MySfml/sockets/main.cpp:73: undefined reference to `sf::IPAddress::IPAddress()'
H:/MySfml/sockets/main.cpp:77: undefined reference to `sf::operator>>(std::istream&, sf::IPAddress&)'
H:/MySfml/sockets/main.cpp:78: undefined reference to `sf::IPAddress::IsValid() const'
H:/MySfml/sockets/main.cpp:82: undefined reference to `sf::SocketTCP::SocketTCP()'
H:/MySfml/sockets/main.cpp:85: undefined reference to `sf::SocketTCP::Connect(unsigned short, sf::IPAddress const&, float)'
H:/MySfml/sockets/main.cpp:87: undefined reference to `sf::operator<<(std::ostream&, sf::IPAddress const&)'
H:/MySfml/sockets/main.cpp:92: undefined reference to `sf::SocketTCP::Receive(char*, unsigned int, unsigned int&)'
H:/MySfml/sockets/main.cpp:102: undefined reference to `sf::SocketTCP::Send(char const*, unsigned int)'
H:/MySfml/sockets/main.cpp:107: undefined reference to `sf::SocketTCP::Close()'
obj\Debug\main.o: In function `Z11DoClientUDPt':
H:/MySfml/sockets/main.cpp:113: undefined reference to `sf::IPAddress::IPAddress()'
H:/MySfml/sockets/main.cpp:117: undefined reference to `sf::operator>>(std::istream&, sf::IPAddress&)'
H:/MySfml/sockets/main.cpp:118: undefined reference to `sf::IPAddress::IsValid() const'
H:/MySfml/sockets/main.cpp:122: undefined reference to `sf::SocketUDP::SocketUDP()'
H:/MySfml/sockets/main.cpp:126: undefined reference to `sf::SocketUDP::Send(char const*, unsigned int, sf::IPAddress const&, unsigned short)'
H:/MySfml/sockets/main.cpp:131: undefined reference to `sf::SocketUDP::Close()'
obj\Debug\main.o: In function `Z11DoServerUDPt':
H:/MySfml/sockets/main.cpp:136: undefined reference to `sf::SocketUDP::SocketUDP()'
H:/MySfml/sockets/main.cpp:139: undefined reference to `sf::SocketUDP::Bind(unsigned short)'
H:/MySfml/sockets/main.cpp:143: undefined reference to `sf::IPAddress::IPAddress()'
H:/MySfml/sockets/main.cpp:147: undefined reference to `sf::SocketUDP::Receive(char*, unsigned int, unsigned int&, sf::IPAddress&, unsigned short&)'
H:/MySfml/sockets/main.cpp:151: undefined reference to `sf::operator<<(std::ostream&, sf::IPAddress const&)'
H:/MySfml/sockets/main.cpp:155: undefined reference to `sf::SocketUDP::Close()'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)



Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Declaraion + Linking error
« Reply #3 on: April 19, 2010, 10:37:45 pm »
These ones are linker errors ;)

Did you link to sfml-network?
Laurent Gomila - SFML developer

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
Declaraion + Linking error
« Reply #4 on: April 20, 2010, 09:18:12 am »
Quote
Linking console executable: bin\Debug\sockets.exe
Let's try smfl-network-d ;)
Mindiell
----

rahul8590

  • Newbie
  • *
  • Posts: 25
    • View Profile
Declaraion + Linking error
« Reply #5 on: April 28, 2010, 09:15:21 pm »
well that linking worked  . kudos to you

But i am unable to understand its working. if i compile that part of code and run it , i am getting one terminal (assuming server) . Now how do i get the client server communicating with each other .