Skip to content

SDL2 example doesn't build with build_win32.bat when using SDL 2.0.12 or newer #3988

@lethal-guitar

Description

@lethal-guitar

Version/Branch of Dear ImGui:

Version: 1.83 WIP
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_sdl.cpp + imgui_impl_opengl3.cpp
Compiler: Visual Studio 2019, v 16.8.4
Operating System: Windows 10

My Issue:

When using build_win32.bat to compile the SDL + OpenGL 3 example on Windows while using SDL 2.0.12 or newer, the build fails with a linker error:

SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp__CommandLineToArgvW@8 referenced in function _main_getcmdline

This error does not occur when using SDL 2.0.10 or earlier. Adding Shell32.lib as a link dependency also fixes the error.

I haven't tested yet if the error also occurs when building with the provided Visual Studio solution.

This dependency was introduced into the SDLmain library in the following commit: libsdl-org/SDL@f8400cb

How to reproduce

  • Download SDL 2.0.12: http://libsdl.org/release/SDL2-devel-2.0.12-VC.zip (or 2.0.14, or newer)
  • Unpack the download to a location of your choice
  • Open a "x86 Native Tools Command Prompt"
  • In the prompt, navigate to Dear ImGui source, into examples/example_sdl_opengl3
  • Set an environment variable to point to where you've unpacked SDL: set SDL2_DIR=<PATH-TO-SDL>
  • Run build_win32.bat

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions