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

Author Topic: RenderWindow is not being displayed  (Read 3846 times)

0 Members and 1 Guest are viewing this topic.

P@u1

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
RenderWindow is not being displayed
« on: March 06, 2011, 08:38:25 pm »
Hi,

today I set up sfml and tried to use it with both eclipse (cdt) and visual studio 2010.
The clock example works fine (with both IDE's).
Then I wanted to try something with graphics.
In this forum I found this example:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include<iostream>
Code: [Select]

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>

int main()
{
   std::cout << "hallo";
   sf::RenderWindow Game(sf::VideoMode(800, 600 ,32 ), "SFML BLANK WINDOW");

   sf::Event Event;

   while (Game.IsOpened())
   {
      while (Game.GetEvent(Event))
      {
         if (Event.Type == sf::Event::Closed)
            Game.Close();
      }

      Game.Clear();

      Game.Display();
   }

   return EXIT_SUCCESS;
}

}


unfortunately the render window is not being displayed, nore "hallo" is displayed.
Also I cant terminate the process from within eclipse (using the red square), but I must shoot the process up with windows task manager.
I'm using windows 7 64 bit.

The strange thing is that the problem occurs both with visual studio and eclipse so I think it's probably not up to my setup.
Here are some things I was not sure about in the setup:
-the order of the libraries in the linker settings (sfml-system-d,sfml-window-d, etc.)
-the preprocessor settings (SFML_DYNAMIC, SFML_STATIC, or just nothing).

Thanks in advance for any suggestions.
If you need further informations to help me just ask me.

Edit: im using an ati graphics card, I read somewhere that some ati drivers can cause problems with sfml, can this be the case here?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
RenderWindow is not being displayed
« Reply #1 on: March 06, 2011, 08:49:25 pm »
Quote
Edit: im using an ati graphics card, I read somewhere that some ati drivers can cause problems with sfml, can this be the case here?

Yes it is.
Laurent Gomila - SFML developer

P@u1

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
RenderWindow is not being displayed
« Reply #2 on: March 06, 2011, 08:54:01 pm »
Is there some faq thread about this?

I have some questions to that:
How can I fix it?
(for example use another driver, but which one and will that lower my graphics experience in other games?)

And will other people with amd graphics cards whom i give my finished programs also have trouble running it?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
RenderWindow is not being displayed
« Reply #3 on: March 06, 2011, 09:00:39 pm »
A workaround is to link statically. The bug is going to be fixed in SFML 2.

You can find a lot of discussions concerning this topic when you use the forum search.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

P@u1

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
RenderWindow is not being displayed
« Reply #4 on: March 06, 2011, 10:20:37 pm »
thx for you help.

Is there a guide about how to link statically? I used the search function but didn't find anything useful so far.

Edit:

Please help me, I dont have any clue how to link statically...

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
RenderWindow is not being displayed
« Reply #5 on: March 06, 2011, 11:47:44 pm »
All you need to do is link to a static version of sfml libraries.

While you do something like sfml-system.lib now, the static version is commonly sfml-system-s.lib, the one you must link.

Its that simple, really! :) Check your libraries folder for some clarifying !

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
RenderWindow is not being displayed
« Reply #6 on: March 07, 2011, 12:14:41 am »
Quote from: "P@u1"
Is there a guide about how to link statically?
For stuff specific to Visual Studio, MSDN should be your first reference.
Walkthrough: Creating and Using a Static Library
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

P@u1

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
RenderWindow is not being displayed
« Reply #7 on: March 07, 2011, 12:16:32 am »
Thanks for you tips. I changed the entries to the ones with -s, but unfortunately I'm now getting lots of errors (compile or link).
Code: [Select]

**** Internal Builder is used for build               ****
g++ -IC:\Program Files\SFML-1.6 g++\include -O0 -g3 -Wall -c -fmessage-length=0 -osrc\Hello World.o ..\src\Hello World.cpp
g++ -LC:\Program Files\SFML-1.6 g++\lib -oHello World.exe src\Hello World.o -lsfml-system-s-d -lsfml-window-s-d -lsfml-graphics-s-d -lsfml-audio-s-d
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s-d.a(Window.o): In function `Window':
D:/dev/sfml/sdk/SFML-1.6/src/SFML/Window/Window.cpp:55: undefined reference to `sf::Clock::Clock()'
D:/dev/sfml/sdk/SFML-1.6/src/SFML/Window/Window.cpp:55: undefined reference to `sf::Clock::Clock()'
D:/dev/sfml/sdk/SFML-1.6/src/SFML/Window/Window.cpp:70: undefined reference to `sf::Clock::Clock()'
D:/dev/sfml/sdk/SFML-1.6/src/SFML/Window/Window.cpp:70: undefined reference to `sf::Clock::Clock()'
D:/dev/sfml/sdk/SFML-1.6/src/SFML/Window/Window.cpp:85: undefined reference to `sf::Clock::Clock()'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s-d.a(Window.o):D:/dev/sfml/sdk/SFML-1.6/src/SFML/Window/Window.cpp:85: more undefined references to `sf::Clock::Clock()' follow
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s-d.a(Window.o):D:/dev/sfml/sdk/SFML-1.6/src/SFML/Window/Window.cpp:358: undefined reference to `sf::Clock::GetElapsedTime() const'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s-d.a(Window.o):D:/dev/sfml/sdk/SFML-1.6/src/SFML/Window/Window.cpp:360: undefined reference to `sf::Sleep(float)'

and lot more (just the beginning)

It would be very nice if you can help me.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
RenderWindow is not being displayed
« Reply #8 on: March 07, 2011, 12:21:59 am »
Are you linking to sfml-system-s.lib in release mode and sfml-system-s-d.lib in debug mode?

By the way, have you tried with Visual Studio? For C++, I personally would prefer it over Eclipse.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

P@u1

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
RenderWindow is not being displayed
« Reply #9 on: March 07, 2011, 12:30:16 am »
so far i only changed the entires for debug mode, i used

sfml-system-s-d
for debug mode and compile in debug mode.

I didn't try the static linking in visual studio so far, but with dynamic linking it didn't work.

Any more suggestions, please?

Edit:
I configured and trief release mode now,
there I still get error, hower just few, here is the complete output (from release mode):
Code: [Select]


**** Build of configuration Release for project Hello World ****

**** Internal Builder is used for build               ****
g++ -IC:\Program Files\SFML-1.6 g++\include -O3 -Wall -c -fmessage-length=0 -osrc\Hello World.o ..\src\Hello World.cpp
g++ -LC:\Program Files\SFML-1.6 g++\lib -oHello World.exe src\Hello World.o -lsfml-system-s -lsfml-graphics-s -lsfml-window-s -lsfml-audio-s
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x3c4): undefined reference to `sf::Clock::Reset()'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x496): undefined reference to `sf::Clock::GetElapsedTime() const'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x4a4): undefined reference to `sf::Clock::Reset()'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x4de): undefined reference to `sf::Clock::GetElapsedTime() const'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x508): undefined reference to `sf::Sleep(float)'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0xde1): undefined reference to `sf::Clock::Clock()'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x10cd): undefined reference to `sf::Clock::Clock()'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x1375): undefined reference to `sf::Clock::Clock()'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x1619): undefined reference to `sf::Clock::Clock()'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x188d): undefined reference to `sf::Clock::Clock()'
C:\Program Files\SFML-1.6 g++\lib/libsfml-window-s.a(Window.o):Window.cpp:(.text+0x1b01): more undefined references to `sf::Clock::Clock()' follow
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 1519  ms.  


please help  :P

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
RenderWindow is not being displayed
« Reply #10 on: March 07, 2011, 07:35:02 am »
From the tutorial:
Quote
When linking to multiple SFML libraries, make sure you link them in the right order, as it's important for MinGW. The rule is the following : if library XXX depends on (uses) library YYY, put XXX first and then YYY. An exemple with SFML : sfml-graphics depends on sfml-window, and sfml-window depends an sfml-system. The link options would be as follows :
Quote

-lsfml-graphics
-lsfml-window
-lsfml-system

Laurent Gomila - SFML developer

P@u1

  • Jr. Member
  • **
  • Posts: 83
    • View Profile
RenderWindow is not being displayed
« Reply #11 on: March 07, 2011, 01:50:23 pm »
THX!

its working now