Compiling for Windows 11 23H2 with Statically Linked Libraries in Microsoft Visual Studio 2022 #164
mydarkthawts
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What and Why?
I figured with the numerous user error issue requests being opened over compilation and dll issues, I'd make a quick text and video guide on how to compile this on Windows 11 23H2 with Statically Linked Libraries in Microsoft Visual Studio 2022.
Use Release instead of Debug when compiling
Some people will run into .dll errors that they aren't paying attention to closely enough. It has the letter D in the .dll filename error popup.
This indicates the executable was compiled with a Debug configuration and uses different runtime libraries for debugging purposes. These debug dynamic linked libraries are not installed with the runtime libraries that people install on target systems. Instead, they exist in your development environment only.
The fix (alternative seen in my video below):
Build
menu near the top of Visual Studio 2022 window.Configuration Manager
near the bottom of the menu.Active solution configuration:
drop down menu, selectRelease
.Close
.Your compiled executable should now run with the runtime libraries installed on the target system without .dll errors.
Statically Linked Libraries instead of using Dynamically Linked Libraries?
Compiling with statically linked libraries allows the executable to run without the need of installing the runtime dependency libraries on the target system(removes the risk of those pesky .dll errors).
The final compiled executable is generally larger in size because it carries with it the dependent libraries it needs to run to avoid those dll errors.
This is seen in my video below:
Multi-threaded (/MT)
in the drop down.Request Admin Privs on Program execution?
You can edit the project settings and configure it to request administrative privileges at execution time if you are having trouble logging keys from certain applications:
Not seen in my video below:
requireAdministrator (/level='requireAdministrator')
in the drop down.Video
comp_in_windows_static.mp4
Beta Was this translation helpful? Give feedback.
All reactions