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

Author Topic: A few issues getting SFML to work properly  (Read 3363 times)

0 Members and 1 Guest are viewing this topic.

nbetcher

  • Newbie
  • *
  • Posts: 5
    • View Profile
A few issues getting SFML to work properly
« on: July 08, 2009, 04:00:10 am »
I have been reading through posts and trying to figure out how to get SFML to work properly on my machine.

I am running 32bit Windows Vista , and using Codeblocks.

The first problem that I'm having is getting the pong demo from the samples in the SDK to run.

I have added SFML_DYNAMIC to my #defines.

In my Other Linker Options I have:
-lsfml-graphics-d
-lsfml-window-d
-lsfml-audio-d
-lsfml-system-d

I have gone through the tutorial to set up SFML on codeblocks many times now and I cannot figure out why I keep getting this problem:


Code: [Select]
-------------- Build: Debug in pong ---------------

Linking console executable: bin\Debug\pong.exe
Info: resolving sf::Font::ourDefaultCharset      by linking to __imp___ZN2sf4Font17ourDefaultCharsetE (auto-import)
Info: resolving vtable for sf::Stringby linking to __imp___ZTVN2sf6StringE (auto-import)
Info: resolving vtable for sf::Spriteby linking to __imp___ZTVN2sf6SpriteE (auto-import)
obj\Debug\pong.o(.text$_ZN2sf6StringD1Ev[sf::String::~String()]+0x3a): In function `ZNSt8_Rb_treeIPN2sf11ResourcePtrINS0_5ImageEEES4_St9_IdentityIS4_ESt4lessIS4_ESaIS4_EE11_M_put_nodeEPSt13_Rb_tree_nodeIS4_E':
C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_construct.h: variable 'vtable for sf::String' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
obj\Debug\pong.o(.text$_ZN2sf6SpriteD1Ev[sf::Sprite::~Sprite()]+0x3a):C:/Dev-Cpp/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/stl_construct.h: variable 'vtable for sf::Sprite' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details.
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings



The second problem that I am having is that every time I run part of the windowing tutorial, it builds and executes but the program hangs and then stops responding every time. The console window and the SFML window pop up, and the SFML window initially has a black background but after a few seconds it turns all white and thats when the not responding message pops up. Here is the code that I have:

Code: [Select]
#include <SFML/Window.hpp>

int main()
{

    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");


    bool Running = true;

    sf::Event Event;

    while (App.GetEvent(Event))
{
    // Window closed
    if (Event.Type == sf::Event::Closed)
        Running = false;

    // Escape key pressed
    if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
        Running = false;
}


while (Running)
{
    App.Display();
}

return 0;
}


I started the project as a console application, using the GNU gcc compiler.

I have set SFML_DYNAMIC in my compiler defines.

In my Other Linker Options I have:
-lsfml-window-d
-lsfml-system-d

I copied all of the lib/mingw files and the /include files to the codeblocks directories.

I'm not sure what i'm doing wrong at this point. I am going to play with it some more when I get a chance. I am very interested in developing with SFML , and if anyone could lend me some advice it would be greatly appreciated!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
A few issues getting SFML to work properly
« Reply #1 on: July 08, 2009, 07:47:34 am »
Hi

1/ It's really like you didn't add SFML_DYNAMIC. Where did you define it?

2/ Look at the tutorials and samples again, you'll see that the event loop is inside the main loop (otherwise you only catch a few events at startup...)
Laurent Gomila - SFML developer

nbetcher

  • Newbie
  • *
  • Posts: 5
    • View Profile
A few issues getting SFML to work properly
« Reply #2 on: July 09, 2009, 04:24:22 am »
Ah, yeah I now that I have changed the code for the windowing segment, I have it working properly. It is no longer crashing. That was a stupid mistake on my part.

I have run into another issue with the pong demo now though, but I will repost as a new thread.

Thank you for the quick response!

nbetcher

  • Newbie
  • *
  • Posts: 5
    • View Profile
A few issues getting SFML to work properly
« Reply #3 on: July 09, 2009, 04:34:36 am »
Scratch that about having another issue, I figured out what the problem was. I tried all of this on an XP machine tonight and got it all working, gonna hop back on my vista box tomorrow and see if I can get those original problems worked out now. Thanks again for the help!