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

MSVC error LNK2019: unresolved external symbol __imp_CommandLineToArgvW referenced in function CLI::detail::compute_win32_argv(void) #1053

Open
np-c0mp1ete opened this issue Jun 11, 2024 · 0 comments
Labels

Comments

@np-c0mp1ete
Copy link

Hello!

I'm using CLI11 in a CMake project on Windows with:

# Don't link implicitly with gdi32.lib, winspool.lib, shell32.lib, etc
# https://stackoverflow.com/questions/41400536/why-cmake-adds-unnecessary-libraries-to-visual-studio-projects
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "")
set(CMAKE_CXX_STANDARD_LIBRARIES "")

This causes a linker error:

error LNK2019: unresolved external symbol __imp_CommandLineToArgvW referenced in function CLI::detail::compute_win32_argv(void)

Since CLI11 uses CommandLineToArgvW() it shouldn't rely on Shell32.lib being implicitly linked and instead do it explicitly.

Best regards,
Nikolai

@phlptp phlptp added the bug label Jun 14, 2024
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