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

Author Topic: Inherit from RenderWindow  (Read 5761 times)

0 Members and 1 Guest are viewing this topic.

Kernelpanic

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • http://eisenholz.bplaced.net
Inherit from RenderWindow
« on: May 18, 2008, 03:15:34 pm »
I wanted to inherit from RenderWindow, but I get alway this error:
Quote

undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, int)'
undefined reference to `sf::RenderWindow::OnEventReceived(sf::Event const&)'


Isn't it allowed to inherit from RenderWindow, or what is the problem, I have copied the constructorarguments from the documentation?

marox

  • Full Member
  • ***
  • Posts: 178
    • View Profile
Inherit from RenderWindow
« Reply #1 on: May 18, 2008, 03:33:36 pm »
link error?
mon tout nouveau siteweb  : Creations

Kernelpanic

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • http://eisenholz.bplaced.net
Inherit from RenderWindow
« Reply #2 on: May 18, 2008, 03:34:52 pm »
Yes, g++-Link error.
regardeless if I make a .o-File or a standard-application.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Inherit from RenderWindow
« Reply #3 on: May 18, 2008, 03:46:54 pm »
Inheriting from RenderWindow is perfectly allowed and should work fine.

Have you linked to sfml-graphics ?
Laurent Gomila - SFML developer

Kernelpanic

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • http://eisenholz.bplaced.net
Inherit from RenderWindow
« Reply #4 on: May 18, 2008, 06:45:57 pm »
I tried a less complex program:
Code: [Select]

#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <string>

using namespace std;
using namespace sf;

class GraficWindow : public RenderWindow
{
public:
GraficWindow()
{}
GraficWindow(VideoMode Mode, const string &Title, unsigned long WindowStyle=(Style::Resize|Style::Close), int AntialiasingLevel=0) : RenderWindow(Mode, Title, WindowStyle, AntialiasingLevel)
{}
};

int main()
{
GraficWindow Main (VideoMode(800, 600, 16), "Test");
Main.SetBackgroundColor(Color(20, 20, 50));
Main.Display();
Clock c;
while(c.GetElapsedTime() < 5)
;
return 0;
};

Compiler:
Code: [Select]

g++ -o testgw ./testgw.cpp -lsfml-graphics -lsfml-window -lsfml-system


Same Error...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Inherit from RenderWindow
« Reply #5 on: May 19, 2008, 02:42:09 am »
Ok, I'll try that as soon as possible. Thanks for your help.
Laurent Gomila - SFML developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Inherit from RenderWindow
« Reply #6 on: May 19, 2008, 10:25:08 am »
I have no problem with your code.

Which version of SFML are you using ? Which OS ?
Laurent Gomila - SFML developer

Kernelpanic

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • http://eisenholz.bplaced.net
Inherit from RenderWindow
« Reply #7 on: May 19, 2008, 03:58:20 pm »
openSuse 10.3, Kernel 2.6.22. SFML 1.2, I couldn't install the SVN-version.

Edit:
I have inserted the missing audio-File into the lib directory and tried make install for the svn-Version again.
Now I can Compile the program, but executing I get problems.
I tried to make a simple RenderWindow, it was working fine:
Quote

Failed to find a suitable pixel format for the window -- cannot create OpenGL context
===== SFML debug informations =====
Window settings : 32/0/0/0
Number of visuals found : 4
--- Visual #0 ---
  RGBA : 1
  DoubleBuffer : 1
  RedSize : 5
  GreenSize : 6
  BlueSize : 5
  AlphaSize : 0
  DepthSize : 16
  StencilSize : 0
  SampleBuffers : 0
  Samples : 0
------------------
--- Visual #1 ---
  RGBA : 1
  DoubleBuffer : 1
  RedSize : 5
  GreenSize : 6
  BlueSize : 5
  AlphaSize : 0
  DepthSize : 16
  StencilSize : 8
  SampleBuffers : 0
  Samples : 0
------------------
--- Visual #2 ---
  RGBA : 1
  DoubleBuffer : 1
  RedSize : 5
  GreenSize : 6
  BlueSize : 5
  AlphaSize : 8
  DepthSize : 16
  StencilSize : 8
  SampleBuffers : 0
  Samples : 0
------------------
--- Visual #3 ---
  RGBA : 1
  DoubleBuffer : 0
  RedSize : 5
  GreenSize : 6
  BlueSize : 5
  AlphaSize : 8
  DepthSize : 16
  StencilSize : 8
  SampleBuffers : 0
  Samples : 0
------------------


But the program is running.
But replacing RenderWindow Main by GraficWindow Main, I get the same message followed by:
Quote

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  8 (X_MapWindow)
  Resource id in failed request:  0x0
  Serial number of failed request:  15
  Current serial number in output stream:  15

And the program aborts.

Strange...

Edit:
I could install the SVN-Version, one Audio-dependency was missing.
But it is still the same error.

Kernelpanic

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • http://eisenholz.bplaced.net
Inherit from RenderWindow
« Reply #8 on: May 19, 2008, 10:35:36 pm »
Okay, I have installed the non-SVN-version again, there was one missing dependeny, it is working fine.
Thank you for your help.

One idea for SFML:
A configure-script would be nice for configrating, which parts are to install and for checking the dependencies.
I am a Shell-Script noob and I use the automatically created by kdevelop configure- and makefiles, but if we have a member with configure-experience?

eleinvisible

  • Newbie
  • *
  • Posts: 47
    • View Profile
Inherit from RenderWindow
« Reply #9 on: May 20, 2008, 12:03:03 am »
Double post there, but when I tried inheriting from RenderWindow it worked fine. For reference, what dependency were you missing?

Kernelpanic

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
    • http://eisenholz.bplaced.net
Inherit from RenderWindow
« Reply #10 on: May 20, 2008, 03:02:32 pm »
I think the glew-devel. (and audiopackages)
So I could not compile the non-SVN-version.
make and su -c "make install"

Yes, dobule post, but they are quite long, not only "opensuse 10.3" and "I have solved the problem".