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

Author Topic: I can`t get my ipaddress  (Read 26189 times)

0 Members and 1 Guest are viewing this topic.

Nobody

  • Newbie
  • *
  • Posts: 7
    • View Profile
I can`t get my ipaddress
« on: April 27, 2008, 01:30:02 pm »
Hi

i do not know my mistake, but i cant get my ipaddress.

I ve tried it in many different ways.

For example
Code: [Select]

    sf::IPAddress IP;
    IP.GetLocalAddress();


Codeblocks says...

Compiling: main.cpp
Linking executable: Network.exe
.objs\main.o:main.cpp:(.text+0x296): undefined reference to `sf::IPAddress::IPAddress()'
.objs\main.o:main.cpp:(.text+0x29b): undefined reference to `sf::IPAddress::GetLocalAddress()'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings

sry english is not my native language

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
I can`t get my ipaddress
« Reply #1 on: April 27, 2008, 01:51:24 pm »
Have you linked to sfml-network ?
Laurent Gomila - SFML developer

Nobody

  • Newbie
  • *
  • Posts: 7
    • View Profile
I can`t get my ipaddress
« Reply #2 on: April 27, 2008, 03:59:05 pm »
Yes

First I tried it so...
Code: [Select]


#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Network.hpp>
#include <iostream>
#include <windows.h>

sf::RenderWindow Main;
sf::Event Eventmenu;
sf::Image ImMainBackground;
sf::Sprite SpMainBackground;
sf::String StIp;


bool exit2;

int main()
{

    Main.Create(sf::VideoMode(300, 500, 32), "test", sf::Style::Close);
    //Main.SetBackgroundColor (sf::Color(0,200,100));
    exit2=false;

    sf::IPAddress IP("nobody");
    StIp.SetText(IP.ToString());

     if (!ImMainBackground.LoadFromFile("1.jpg"))
         return EXIT_FAILURE;
     SpMainBackground.SetImage(ImMainBackground);


    while(exit2==false)
    {

    while (Main.GetEvent(Eventmenu))
         {
             // Close window : exit
            if (Eventmenu.Type == sf::Event::Closed)
                {
                    exit2=true;
                }
         }


    //Main.SetFramerateLimit(50);
    Main.Draw(SpMainBackground);
    Main.Display();

    }
    return 0;
}


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
I can`t get my ipaddress
« Reply #3 on: April 27, 2008, 04:22:36 pm »
What are your linker settings ? Which version of the SFML libraries are you using (static or dynamic) ?
Laurent Gomila - SFML developer

Nobody

  • Newbie
  • *
  • Posts: 7
    • View Profile
I can`t get my ipaddress
« Reply #4 on: April 27, 2008, 04:38:50 pm »
i have got version 1.2 (static)

i have done it like it is said in the tutorial and everthings else runs fine (sprite ...)

should i use dynamic?

Nobody

  • Newbie
  • *
  • Posts: 7
    • View Profile
I can`t get my ipaddress
« Reply #5 on: April 27, 2008, 04:42:11 pm »
now it runs fine

i have forgotten "-lsfml-network"?

thank you

sfml is an excellent project...good work

I hope in the future there are also control elements like buttons and so on

 

anything