[ERROR] SDL2 Drop Events don't work when run from Cmder

Hello, so I’ve been working with SDL for a while and I just found a really strange behaviour on the DropXXX events. If I run my program by double clicking it, drag and drop events work correctly, but if I run it from the terminal it simply does not work, those events seem to even be disabled because the window does not recognize them. I also tried running it from RemedyBG trying to debug the error, but with RemedyBG it does indeed break on the event and therefore, within RemedyBG the event also works correctly. I was worried it was becaused something wrong on my base code, but it is reproducilble even with SDL’s Wiki example. I’m working on Windows btw.

// Example program:
// SDL_DropEvent usage

#include "SDL.h"

int main(int argc, char *argv[]) {
    SDL_bool done;
    SDL_Window *window;
    SDL_Event event;                        // Declare event handle
    char* dropped_filedir;                  // Pointer for directory of dropped file

    SDL_Init(SDL_INIT_VIDEO);               // SDL2 initialization

    window = SDL_CreateWindow(  // Create a window
        "SDL_DropEvent usage, please drop the file on window",

    // Check that the window was successfully made
    if (window == NULL) {
        // In the event that the window could not be made...
        SDL_Log("Could not create window: %s", SDL_GetError());
        return 1;


    done = SDL_FALSE;
    while (!done) {                         // Program loop
        while (!done && SDL_PollEvent(&event)) {
            switch (event.type) {
                case (SDL_QUIT): {          // In case of exit
                    done = SDL_TRUE;

                case (SDL_DROPFILE): {      // In case if dropped file
                    dropped_filedir = event.drop.file;
                    // Shows directory of dropped file
                        "File dropped on window",
                    SDL_free(dropped_filedir);    // Free dropped_filedir memory

    SDL_DestroyWindow(window);        // Close and destroy the window

    SDL_Quit();                       // Clean up
    return 0;

Just compile that program and see how it behaves in from the terminal and just from double clicking. Is this a known error? I could not find that much information about this problem. If anyone knows something on why this is happening or how to fix it, let me know pls!

Thank you so much in advance.

1 Like

(Sorry I don’t own a Windows machine, but for the next person I would like to clear up some things):

  1. Is this Windows 10 or 11?
  2. When you say run from the terminal, do you mean the terminal from your IDE, the default Windows PowerShell, or a secondary Bash shell? (I would assume Powershell, but you never know unless it’s been said)
  3. Which Compiler/IDE combo are you building with?

Oh yeah sorry, I forgot to add those infos here.

  1. Windows 11
  2. From the terminal itself, no IDE, I use Cmder.
  3. I’m using plain clang to compile

Yesterday was late and I forgot to test with other terminal, I have just tried with CMD and it is working fine, but not with Cmder, anyone wonder why this is happening? Should I add any extra flags to the compilation?

I tried with:

clang -g -O0 main.cpp -I ../RDE/external/include/SDL2 -L ..\RDE\external\libs\windows\manual-link\ -L ../RDE/external/libs/windows -lSDL2main -lSDL2 -lwinmm -lgdi32 -Xlinker /subsystem:console -lShell32 -o main.exe

In the next link, someone says they right clicked on cmder.exe itself (I’m guessing they tracked down the installed file directory) and hit properties → [x]unblock. That at least gave them drag and drop capability for the terminal itself. Perhaps giving it higher permissions will in return give it’s child processes higher permisions?

You might also leave them an issue/bug report there since it’s their official github account so as to contact their developers about the issue. → Hah! I just noticed you already posted one half an hour before I wrote this, right on!

Thanks for the link to the issue! So it seems the problem was that I did start Cmder as admin and this, for some reason, blocks the drag&drop features, I don’t know why, but starting as no-admin worked. In the cmder issue I opened the sent me to post it to ConEmu, as it seems it is something with them and not really cmder, anyways, thank you so much for your help!