find_visual_studio_and_windows_sdk() now returns the newest available version of Visual Studio instead of the first found #4085
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have three versions of Visual Studio on my machine 2017, 2019 and 2022. The latest version of Odin dev-2024-08-nightly:8359995 was failing to build the simplest "hello world" program giving an error:
libucrt.lib(checkcfg.obj) : error LNK2001: unresolved external symbol guard_check_icall$fo$
C:/Dev/Odin/dev/odin1.exe : fatal error LNK1120: 1 unresolved externals
-print-linker-flags was showing following:
/LIBPATH:"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.26100.0/um/x64" /LIBPATH:"C:/Program Files (x86)/Windows Kits/10/Lib/10.0.26100.0/ucrt/x64" /LIBPATH:"C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/lib/x64" /ENTRY:mainCRTStartup /defaultlib:libcmt /NOIMPLIB /NOEXP /incremental:no /opt:ref /nologo /subsystem:CONSOLE /machine:x64 "kernel32.lib"
Which is obviously picking the oldest version of Visual Studio.
Inspecting the code I found that it returns the first Visual Studio that comes out of version enumeration. This fix is finding the newest version of Visual Studio instead and it fixed my linking problem.
I'm not sure if this is the right fix for linking problem I mentioned, maybe it should work with VS2017 in the first place.