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.


Topics - BoingBoing

Pages: [1]
1
Network / SFML Window and Packet frozen
« on: January 11, 2010, 04:16:57 am »
I could receive packets and send them but the SFML window just freezes.
Code: [Select]
#ifdef _WIN32
//#include <windows.h>
#endif

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window/Event.hpp>
#include <SFML/Network.hpp>
#include <sys/timeb.h>
#include <time.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <fstream>
using namespace std;

sf::Clock Clock;
sf::RenderWindow App;

float CurTime( void )
{
return Clock.GetElapsedTime();
}

void Initialize();
void Draw();
void Think();
void KeyPress(sf::Key::Code Key);
void KeyReleased(sf::Key::Code Key);
void OnRecieve(const char* Message);
float NextThink = 0;
sf::SocketTCP Client;

int main()
{
App.Create(sf::VideoMode(640, 480), "MMOClient v0.1");

ifstream ipfile("ip.txt",ios::in);
    sf::IPAddress ServerAddress;
ipfile >> ServerAddress;
ipfile.close();
const unsigned short Port = 2435;
if (Client.Connect(Port,ServerAddress) == sf::Socket::Done)
{
std::cout << "Connected to server " << ServerAddress << std::endl;
} else {
App.Close();
}

//Initialize();
bool isrunning = true;
while (isrunning)
{
sf::Packet p;
std::string s;
if (Client.Receive(p) == sf::Socket::Done)
{
p >> s;
std::cout << s << std::endl;
}
char ToSend[] = "w-off";
Client.Send(ToSend, sizeof(ToSend));
App.Clear();
Draw();
App.Display();
}
    /*while (App.IsOpened())
    {
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            if (Event.Type == sf::Event::Closed)
                App.Close();
if (Event.Type == sf::Event::KeyPressed)
KeyPress(Event.Key.Code);
if (Event.Type == sf::Event::KeyReleased)
KeyReleased(Event.Key.Code);
        }

//if (Client.Receive(Message, sizeof(Message), Received))
//{
//OnRecieve(Message);
//}
if (NextThink < CurTime())
{
NextThink = CurTime() + 0.02;
Think();
}
App.Clear();
Draw();
App.Display();
    }*/
Client.Close();
    return EXIT_SUCCESS;
}

2
General / Static Library Link Errors
« on: August 18, 2009, 10:25:54 am »
Version: SFML 1.5
Compiler: Visual C++ 2005 Express Edition
Description: Happens whenever I try to link to a static library, linking to anything other than a static library works.
Here's my setup: sfml-window.lib sfml-graphcs-s.lib sfml-system.lib lua5.1.lib user32.lib
I only have SFML_DYNAMIC for my Preprocessor Definitions.
Build Log:
Code: [Select]
1>------ Build started: Project: HIT, Configuration: Release Win32 ------
1>Linking...
1>collision.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> const & __thiscall sf::Drawable::GetPosition(void)const " (__imp_?GetPosition@Drawable@sf@@QBEABV?$Vector2@M@2@XZ) referenced in function "public: static bool __cdecl Collision::CircleTest(class sf::Sprite const &,class sf::Sprite const &)" (?CircleTest@Collision@@SA_NABVSprite@sf@@0@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> const & __thiscall sf::Drawable::GetPosition(void)const " (__imp_?GetPosition@Drawable@sf@@QBEABV?$Vector2@M@2@XZ)
1>collision.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> __thiscall sf::Sprite::GetSize(void)const " (__imp_?GetSize@Sprite@sf@@QBE?AV?$Vector2@M@2@XZ) referenced in function "public: static bool __cdecl Collision::CircleTest(class sf::Sprite const &,class sf::Sprite const &)" (?CircleTest@Collision@@SA_NABVSprite@sf@@0@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> __thiscall sf::Sprite::GetSize(void)const " (__imp_?GetSize@Sprite@sf@@QBE?AV?$Vector2@M@2@XZ)
1>collision.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Drawable::GetRotation(void)const " (__imp_?GetRotation@Drawable@sf@@QBEMXZ) referenced in function "public: static bool __cdecl Collision::BoundingBoxTest(class sf::Sprite const &,class sf::Sprite const &)" (?BoundingBoxTest@Collision@@SA_NABVSprite@sf@@0@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Drawable::GetRotation(void)const " (__imp_?GetRotation@Drawable@sf@@QBEMXZ)
1>collision.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> __thiscall sf::Drawable::TransformToGlobal(class sf::Vector2<float> const &)const " (__imp_?TransformToGlobal@Drawable@sf@@QBE?AV?$Vector2@M@2@ABV32@@Z) referenced in function "public: static class sf::Rect<int> __cdecl Collision::GetAABB(class sf::Sprite const &)" (?GetAABB@Collision@@SA?AV?$Rect@H@sf@@ABVSprite@3@@Z)
1>collision.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Color __thiscall sf::Sprite::GetPixel(unsigned int,unsigned int)const " (__imp_?GetPixel@Sprite@sf@@QBE?AVColor@2@II@Z) referenced in function "public: static bool __cdecl Collision::PixelPerfectTest(class sf::Sprite const &,class sf::Sprite const &,unsigned char)" (?PixelPerfectTest@Collision@@SA_NABVSprite@sf@@0E@Z)
1>collision.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> __thiscall sf::Drawable::TransformToLocal(class sf::Vector2<float> const &)const " (__imp_?TransformToLocal@Drawable@sf@@QBE?AV?$Vector2@M@2@ABV32@@Z) referenced in function "public: static bool __cdecl Collision::PixelPerfectTest(class sf::Sprite const &,class sf::Sprite const &,unsigned char)" (?PixelPerfectTest@Collision@@SA_NABVSprite@sf@@0E@Z)
1>collision.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Rect<int> const & __thiscall sf::Sprite::GetSubRect(void)const " (__imp_?GetSubRect@Sprite@sf@@QBEABV?$Rect@H@2@XZ) referenced in function "public: static bool __cdecl Collision::PixelPerfectTest(class sf::Sprite const &,class sf::Sprite const &,unsigned char)" (?PixelPerfectTest@Collision@@SA_NABVSprite@sf@@0E@Z)
1>main.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class sf::Rect<int> const & __thiscall sf::Sprite::GetSubRect(void)const " (__imp_?GetSubRect@Sprite@sf@@QBEABV?$Rect@H@2@XZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Drawable::SetColor(class sf::Color const &)" (__imp_?SetColor@Drawable@sf@@QAEXABVColor@2@@Z) referenced in function "int __cdecl LuaHook_SetColor(struct lua_State *)" (?LuaHook_SetColor@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z) referenced in function "int __cdecl LuaHook_SetColor(struct lua_State *)" (?LuaHook_SetColor@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Drawable::SetPosition(float,float)" (__imp_?SetPosition@Drawable@sf@@QAEXMM@Z) referenced in function "int __cdecl LuaHook_SetPosition(struct lua_State *)" (?LuaHook_SetPosition@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Drawable::SetScale(float,float)" (__imp_?SetScale@Drawable@sf@@QAEXMM@Z) referenced in function "int __cdecl LuaHook_SetScale(struct lua_State *)" (?LuaHook_SetScale@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Drawable::SetRotation(float)" (__imp_?SetRotation@Drawable@sf@@QAEXM@Z) referenced in function "int __cdecl LuaHook_SetAngle(struct lua_State *)" (?LuaHook_SetAngle@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Drawable::SetCenter(float,float)" (__imp_?SetCenter@Drawable@sf@@QAEXMM@Z) referenced in function "int __cdecl LuaHook_SetCenter(struct lua_State *)" (?LuaHook_SetCenter@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::FlipX(bool)" (__imp_?FlipX@Sprite@sf@@QAEX_N@Z) referenced in function "int __cdecl LuaHook_FlipX(struct lua_State *)" (?LuaHook_FlipX@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::FlipY(bool)" (__imp_?FlipY@Sprite@sf@@QAEX_N@Z) referenced in function "int __cdecl LuaHook_FlipY(struct lua_State *)" (?LuaHook_FlipY@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Color const & __thiscall sf::Drawable::GetColor(void)const " (__imp_?GetColor@Drawable@sf@@QBEABVColor@2@XZ) referenced in function "int __cdecl LuaHook_GetColor(struct lua_State *)" (?LuaHook_GetColor@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> const & __thiscall sf::Drawable::GetCenter(void)const " (__imp_?GetCenter@Drawable@sf@@QBEABV?$Vector2@M@2@XZ) referenced in function "int __cdecl LuaHook_GetCenter(struct lua_State *)" (?LuaHook_GetCenter@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class sf::Vector2<float> const & __thiscall sf::Drawable::GetScale(void)const " (__imp_?GetScale@Drawable@sf@@QBEABV?$Vector2@M@2@XZ) referenced in function "int __cdecl LuaHook_GetScale(struct lua_State *)" (?LuaHook_GetScale@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __thiscall sf::RenderTarget::Draw(class sf::Drawable const &)" (__imp_?Draw@RenderTarget@sf@@UAEXABVDrawable@2@@Z) referenced in function "int __cdecl LuaHook_DrawSprite(struct lua_State *)" (?LuaHook_DrawSprite@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::Clear(class sf::Color const &)" (__imp_?Clear@RenderTarget@sf@@QAEXABVColor@2@@Z) referenced in function "int __cdecl LuaHook_ClearScreen(struct lua_State *)" (?LuaHook_ClearScreen@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::~Image(void)" (__imp_??1Image@sf@@QAE@XZ) referenced in function "public: __thiscall std::pair<int const ,class sf::Image>::~pair<int const ,class sf::Image>(void)" (??1?$pair@$$CBHVImage@sf@@@std@@QAE@XZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::Image(class sf::Image const &)" (__imp_??0Image@sf@@QAE@ABV01@@Z) referenced in function "public: __thiscall std::pair<int const ,class sf::Image>::pair<int const ,class sf::Image>(int const &,class sf::Image const &)" (??0?$pair@$$CBHVImage@sf@@@std@@QAE@ABHABVImage@sf@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::SetSubRect(class sf::Rect<int> const &)" (__imp_?SetSubRect@Sprite@sf@@QAEXABV?$Rect@H@2@@Z) referenced in function "int __cdecl LuaHook_SetSubRect(struct lua_State *)" (?LuaHook_SetSubRect@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Image::Image(void)" (__imp_??0Image@sf@@QAE@XZ) referenced in function "public: class sf::Image & __thiscall std::map<int,class sf::Image,struct std::less<int>,class std::allocator<struct std::pair<int const ,class sf::Image> > >::operator[](int const &)" (??A?$map@HVImage@sf@@U?$less@H@std@@V?$allocator@U?$pair@$$CBHVImage@sf@@@std@@@4@@std@@QAEAAVImage@sf@@ABH@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Image::LoadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?LoadFromFile@Image@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "int __cdecl LuaHook_CreateImage(struct lua_State *)" (?LuaHook_CreateImage@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Sprite::SetImage(class sf::Image const &)" (__imp_?SetImage@Sprite@sf@@QAEXABVImage@2@@Z) referenced in function "int __cdecl LuaHook_CreateSprite(struct lua_State *)" (?LuaHook_CreateSprite@@YAHPAUlua_State@@@Z)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::String::~String(void)" (__imp_??1String@sf@@UAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(class sf::Unicode::Text const &,class sf::Font const &,float)" (__imp_??0String@sf@@QAE@ABVText@Unicode@1@ABVFont@1@M@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class sf::Font const & __cdecl sf::Font::GetDefaultFont(void)" (__imp_?GetDefaultFont@Font@sf@@SAABV12@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::String::SetSize(float)" (__imp_?SetSize@String@sf@@QAEXM@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::String::SetFont(class sf::Font const &)" (__imp_?SetFont@String@sf@@QAEXABVFont@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::String::SetText(class sf::Unicode::Text const &)" (__imp_?SetText@String@sf@@QAEXABVText@Unicode@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(void)" (__imp_??0String@sf@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Font::~Font(void)" (__imp_??1Font@sf@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __thiscall sf::Font::LoadFromFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int,class sf::Unicode::Text const &)" (__imp_?LoadFromFile@Font@sf@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IABVText@Unicode@2@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) private: static unsigned int * sf::Font::ourDefaultCharset" (__imp_?ourDefaultCharset@Font@sf@@0PAIA) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Font::Font(void)" (__imp_??0Font@sf@@QAE@XZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function "void __cdecl `dynamic initializer for 'App''(void)" (??__EApp@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Sprite::Sprite(void)" (__imp_??0Sprite@sf@@QAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'SpriteArray''(void)" (??__ESpriteArray@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Sprite::~Sprite(void)" (__imp_??1Sprite@sf@@UAE@XZ) referenced in function "void __cdecl `dynamic initializer for 'SpriteArray''(void)" (??__ESpriteArray@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'App''(void)" (??__FApp@@YAXXZ)
1>C:\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\Release\HIT.exe : fatal error LNK1120: 41 unresolved externals
1>Build log was saved at "file://c:\Users\Henry\Documents\Visual Studio 2005\Projects\HIT\HIT\Release\BuildLog.htm"
1>HIT - 46 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Pages: [1]
anything