Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7802999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:25:48+00:00 2026-06-02T01:25:48+00:00

I can find no examples of code running SDL2, and when I try to

  • 0

I can find no examples of code running SDL2, and when I try to compile the following code on DMD2 using Derelict SDL2 I get the above error. Is there a new set of procedure for initializing SDL2?

The code is:

import std.stdio;
import derelict.sdl2.sdl;
import derelict.sdl2.types;
import derelict.opengl3.gl3;

private import EventHub;

pragma(lib, "DerelictUtil.lib");
pragma(lib, "DerelictGL3.lib");
pragma(lib, "derelictSDL2.lib");

bool running=true;
SDL_Surface *screen;

class App{
    private EventHub ehub;
    private bool virgin=true;
    private int w=1024, h=768, bpp=24;
    private int flags=SDL_GL_DOUBLEBUFFER;//| SDL_FULLSCREEN

    public void init(){
        initSDL();
    }

    private bool initSDL(){
        if(SDL_Init(SDL_INIT_VIDEO)<0){
            SDL_Quit();
            writeln("Error initializing SDL_Video");
            writeln(SDL_GetError());
            return false;
        }
        writeln("fred");

        SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
        SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
        SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2);
        SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

        screen=SDL_SetVideoMode(w, h, bpp, flags);

        return true;
    }
}

void main(){
    try{
        DerelictGL3.load();
    }catch(Exception e){
        writeln("Error loading GL3");
    }
    try{
        DerelictSDL2.load();
    }catch(Exception e){
        writeln("Error loading SDL");
    }

    App a=new App();
    a.init();
}

The program prints “fred” if the screen=SDL_SetVideoMode(w, h, bpp, flags); statement is commented out, therefore SDL is loading and initializing OK. Does anyone have any clues?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:25:49+00:00Added an answer on June 2, 2026 at 1:25 am

    SDL 1.3 (to be released as version 2 when completed) doesn’t have a real SDL_SetVideoMode function. (The documentation mentions a compatibility stub, but it’s probably absent from Derelict.) See the migration guide for more details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Where can I find examples of code, written in Unified Parallel C? I also
I'm trying to use PyLucene, and I can't find any code examples that actually
I've heard powershell 2.0 CTP has modules, but I can't find much example code
I've been looking into multi-module projects in Maven, and I can only find examples
Sure I've seen this done before but off-hand I can't find any examples. I've
I herd about RED5, but unfortunately I can't find any examples for feeding it
I am trying to parse XML with jsoup, but I can't find any examples
The examples I can find use a two layer architecture, where the controllers directly
I'm very new to Linq, I can find multi-line data reading examples everywhere (by
I love the idea of Grizzly, but I can't find any good examples to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.