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

Author Topic: Problems with DSFML2 [help!]  (Read 5144 times)

0 Members and 1 Guest are viewing this topic.

SuperV1234

  • SFML Team
  • Full Member
  • *****
  • Posts: 188
    • View Profile
Problems with DSFML2 [help!]
« on: September 30, 2012, 03:17:25 pm »
module main;

import std.stdio;
import derelict.sfml2.system;
import derelict.sfml2.window;
import derelict.sfml2.graphics;
import derelict.sfml2.audio;

void main(string[] args)
{
        DerelictSFML2Window.load();
    DerelictSFML2System.load();
        DerelictSFML2Graphics.load();
    DerelictSFML2Audio.load();
       
        sfRenderWindow window;
}

This is my code. I get this error when compiling:
Quote
C:\D\dmd2\windows\bin\dmd.exe -O -release "main.d"  "D:\Vee\Software\WIP\TEST1234\TEST1234\lib\DerelictGL.lib" "D:\Vee\Software\WIP\TEST1234\TEST1234\lib\DerelictGLU.lib" "D:\Vee\Software\WIP\TEST1234\TEST1234\lib\DerelictSFML2.lib" "D:\Vee\Software\WIP\TEST1234\TEST1234\lib\DerelictUtil.lib" "D:\Vee\Software\WIP\TEST1234\TEST1234\lib\DerelictIL.lib"  -I"C:\D\dmd2\src\druntime\import" -I"C:\D\dmd2\src\phobos" -I"D:\Vee\Software\WIP\TEST1234\TEST1234\import" -I"D:\Vee\Software\WIP\TEST1234\TEST1234\lib"  -odobj\Release -of"D:\Vee\Software\WIP\TEST1234\TEST1234\bin\Release\TEST1234.exe" 

D:\Vee\Software\WIP\TEST1234\TEST1234\import\derelict\sfml2\graphicstypes.d(40): Error: struct derelict.sfml2.graphicstypes.sfRenderWindow unknown size

D:\Vee\Software\WIP\TEST1234\TEST1234\import\derelict\sfml2\graphicstypes.d(40): Error: struct derelict.sfml2.graphicstypes.sfRenderWindow no size yet for forward reference

D:\Vee\Software\WIP\TEST1234\TEST1234\import\derelict\sfml2\graphicstypes.d(40): Error: struct derelict.sfml2.graphicstypes.sfRenderWindow unknown size

D:\Vee\Software\WIP\TEST1234\TEST1234\import\derelict\sfml2\graphicstypes.d(40): Error: struct derelict.sfml2.graphicstypes.sfRenderWindow no size yet for forward reference

main.d(16): Error: variable main.main.window no definition of struct sfRenderWindow

D:\Vee\Software\WIP\TEST1234\TEST1234\import\derelict\sfml2\graphicstypes.d(40): Error: struct derelict.sfml2.graphicstypes.sfRenderWindow unknown size

D:\Vee\Software\WIP\TEST1234\TEST1234\import\derelict\sfml2\graphicstypes.d(40): Error: struct derelict.sfml2.graphicstypes.sfRenderWindow no size yet for forward reference

Exit code 1

How can I fix that?

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Problems with DSFML2 [help!]
« Reply #1 on: October 06, 2012, 10:56:53 pm »
The reason you get a bunch of things telling you it doesn't know the size is because Derelict only users a forward declaration for sfWindow and sfRenderWindow. It never actually defines it, so D doesn't know how much memory to reserve for the object. This is ok because you don't actually need to know.

If you instead use a pointer, you will be fine:

sfRenderWindow* window

All of the C functions with windows and render windows as parameters take a pointer to the window, not a reference to the object. Likewise, the functions that create windows return a pointer to a window object.
DSFML - SFML for the D Programming Language.

 

anything