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.


Messages - Pfeffer

Pages: [1]
1
General / Re: Static linking to SFML 2.0 libraries doesn't work
« on: June 01, 2013, 03:20:24 pm »
Since it was an link error, I totally thought the problem was with the link command, but I had to add the -DSFML_STATIC flag to the compile command.

Tank you.

2
General / Static linking to SFML 2.0 libraries doesn't work
« on: June 01, 2013, 01:34:39 am »
I have a big project where I just moved from SFML 1.6 to 2.0. Dynamic linking worked fine until now. After changing to static linking I get this error:

src/input.o:input.cpp:(.text+0x1c): undefined reference to `_imp___ZN2sf6Window5closeEv'
src/input.o:input.cpp:(.text+0x1f3): undefined reference to `_imp___ZN2sf5Mouse11setPositionERKNS_7Vector2IiEERKNS_6WindowE'
src/input.o:input.cpp:(.text+0x21c): undefined reference to `_imp___ZN2sf8Keyboard12isKeyPressedENS0_3KeyE'
src/input_mode.o:input_mode.cpp:(.text+0x6c): undefined reference to `_imp___ZN2sf8Keyboard12isKeyPressedENS0_3KeyE'
src/application_context.o:application_context.cpp:(.text+0xaa): undefined reference to `_imp___ZN2sf9VideoMode18getFullscreenModesEv'
src/application_context.o:application_context.cpp:(.text+0xdd): undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
src/application_context.o:application_context.cpp:(.text+0x11f): undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'
src/application_context.o:application_context.cpp:(.text+0x158): undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'


Compiling is fine and I cleaned the project many times. I compiled the SFML 2.0 libraries by myself, with CMake and MinGW-GCC. The dynamic libraries worked fine. I have set BUILD_SHARED_LIBS = FALSE for compiling the static libs.

The result were this lib files (I only need this 3) which I added to the "lib" directory to my project:
  • libsfml-window-s.a
  • libsfml-system-s.a
  • libsfml-graphics-s.a

I used the following command to link with MinGW-GCC 4.7.2:
g++  -DSFML_STATIC -Iinc -std=gnu++0x -O3 -fmessage-length=0 -DNDEBUG  -o bin/SFML-Prototype-Release.exe (object files) -Llib -Lbin -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lFreeImage  -lglew32 -lglu32 -lopengl32

And having files in "bin" directory:
  • FreeImage.dll
  • glew32.dll
And files in "lib" directory:
  • libsfml-window-s.a
  • libsfml-system-s.a
  • libsfml-graphics-s.a
  • FreeImage.lib

Hard- & Software:
I am using Windows 7 Prof. 64bit on a 5 year old notebook hardware:
Intel 2 Duo P8600 - 2.4Ghz
Nvidia Geforce 9600M GT
4GB RAM

3
So the problem really was the update to SFML 2.0: A buggy pollEvents function which always returns a MouseMoved event, when no other events are available.

But it is not completly solved, since I can't change the pollEvents() function. I will create a bug report on this.

Update: Nailed it (https://github.com/SFML/SFML/issues/399).

4
General / Empty window after porting from SFML 1.6 to 2.0 [Solved]
« on: May 31, 2013, 12:18:07 am »
Hello guys,

I have a big problem after updating a big project to SFML 2.0 from 1.6. The program seems to run fine (no errors) and the window is shown, but it is always empty (transparent, i see what was before the window appeared). I can move the mouse cursor, but that's it. The program worked fine before updaing to 2.0. I needed to compile SFML 2.0 by myself, since I had to update my mingw-gcc compiler for this update (precompiled libs didn't work with mingw-gcc 4.7.2).

While porting I already paid attention to this list of differences between 1.6 and 2.0:
http://en.sfml-dev.org/forums/index.php?topic=5343.0
  • I removed the SFML_DYNAMIC definition from linkage (I already used dynamic libs before).
  • Replaced Input class with used correspoding class.
  • Changed to pollEvent() function, not waitEvent.
  • Added OpenGL context values, which I used before (OpenGL 3.3)

Facts until now (will be updated):
  • No infinite calculations are done, since the program responds to the "LostFocus" and "GainedFocus" events. (I stop my game timers when loosing focus and resuming them when gaining focus again).
  • (Added) The program is stuck in an infinite loop of pollEvents(), until it looses focus. Then the program seem to run fine again (even renders). But after regaining focus, it is stuck in the loop again.
  • (Added, Problem) The event which doesn't seem to stop is the MouseMoved event. It only stops, after loosing focus of the window.
  • The display()-method of my Window instance is used (checked it in debugger)
  • The libraries seem to work fine now, since the precompiled ones didn't before and the program crashed everytime.
  • No OpenGL errors, exceptions or anything else occurs.

Code of the handleEvents function:
void
InteractionHandler::handleEvents() {
    sf::Event Event;
    while (windowInstance->pollEvent(Event)) {
        switch (Event.type) {
        case sf::Event::Closed:
            appContext->App->close();
            exit(0);
            break;
        case sf::Event::GainedFocus:
            appContext->hasFocus = true;
            break;
        case sf::Event::LostFocus:
            appContext->hasFocus = false;
            break;
            break;
        case sf::Event::MouseMoved:
            onMouseMovement(Event.mouseMove.x, Event.mouseMove.y);
            break;
        }
    }
}


Project Description:
The project is a little game which only uses 2 dynamic libs of SFML: libsfml-system and libsfml-window. It uses OpenGL (3.3) using also GLEW 1.6.0 (1.9.0 didn't work). I've put the glew include into the SFML OpenGL header (SFML/Window/OpenGL.cpp), before the GL headers and after the windows.h. My program is structured like the OpenGL example, but a little more complex:
http://www.sfml-dev.org/tutorials/2.0/window-opengl.php
I only use one window and only one thread. Expect for GLEW  my only other library I use is FreeImage to load some textures. Rendering is done via Shaders (Vertex, Geometry and Fragment Shaders), also using VBOs and VAOs for the vertex data. Input is only done with keyboard and mouse.

Compilation of SFML 2.0:
I used the CMake-GUI tool. Selected the directory of the extracted SFML 2.0 sources, configured the project (BUILD_SHARED_LIBS = TRUE, CMAKE_BUILD_TYPE = Release) and then generated the Makefile. I targeted a Makefile project with the MinGW-GCC compiler (default compiler). Then I opened a console and used mingw32-make to compile SFML 2.0 with the generated Makefile. I followed this instructions without knowing: http://www.sfml-dev.org/tutorials/2.0/compile-with-cmake.php

Hard- & Software:
I am using Windows 7 Prof. 64bit on a 5 year old notebook hardware:
Intel 2 Duo P8600 - 2.4Ghz
Nvidia Geforce 9600M GT
4GB RAM

Situation before updating:
Project used SFML 1.6. Program used OpenGL 3.3 with GLEW. No OpenGL errors were printed and the game ran fine.

I've already paid attention to the "Read before posting"-thread (http://en.sfml-dev.org/forums/index.php?topic=5559.0) and cleaned and recompiled the project several times.

I will try to post a very reduced version of my program, if no one has a clue.

Thanks for your help.

Pages: [1]
anything