Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lethal-guitar opened this issue Mar 30, 2021 · 4 comments
Labels

Comments

@lethal-guitar
Copy link
Contributor

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
@ocornut
Copy link
Owner

ocornut commented Mar 30, 2021

Thank you. Could you check if it also occurs with the provided Visual Studio projects?
(You can add the vcproj to the existing solution to test this)

@lethal-guitar
Copy link
Contributor Author

Sure thing, will do! 👍🏻

ocornut added a commit that referenced this issue Mar 31, 2021
…lib required by SDL2main.lib since SDL 2.0.12. [#3988, #3884] + added batch file for SDL+Vulkan.
@ocornut
Copy link
Owner

ocornut commented Mar 31, 2021

Thank you. Could you check if it also occurs with the provided Visual Studio projects?

I checked and since shell32 is part of the default librairies and we don't explicit omit them it works.
Committed the changes in 2403ed9 and adding the missing batch file for SDL+Vulkan example.

@ocornut ocornut closed this as completed Mar 31, 2021
@lethal-guitar
Copy link
Contributor Author

Ah nice one, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants