for some (tricky) cases one might need to build hes/her code from the VC++ command line
in this case the linker is not happy, eg:
c:\Users\user\source\repos\vm_tester>cl cli.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30153 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cli.cpp
c:\Users\user\source\repos\vm_tester\vmaware.hpp(754): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
Microsoft (R) Incremental Linker Version 14.29.30153.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:cli.exe
cli.obj
cli.obj : error LNK2019: unresolved external symbol __imp__GetUserNameA@8 referenced in function "private: static bool __cdecl VM::user_check(void)" (?user_check@VM@@CA_NXZ)
cli.obj : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "public: bool __thiscall <lambda_f49e2cc4151d968a45b56bd5552f53de>::operator()(char const *)const " (??R
<lambda_f49e2cc4151d968a45b56bd5552f53de>@@QBE_NPBD@Z)
cli.obj : error LNK2019: unresolved external symbol __imp__RegEnumKeyExW@32 referenced in function "private: static bool __cdecl VM::hyperv_registry(void)" (?hyperv_registry@VM@@CA_NXZ)
cli.obj : error LNK2019: unresolved external symbol __imp__RegOpenKeyExA@20 referenced in function "public: bool __thiscall <lambda_f49e2cc4151d968a45b56bd5552f53de>::operator()(char const *)const " (
??R<lambda_f49e2cc4151d968a45b56bd5552f53de>@@QBE_NPBD@Z)
cli.obj : error LNK2019: unresolved external symbol __imp__RegOpenKeyExW@20 referenced in function "public: void __thiscall <lambda_fabddcdefc99831fc201e2118c777bd6>::operator()(char const *,char cons
t *)const " (??R<lambda_fabddcdefc99831fc201e2118c777bd6>@@QBEXPBD0@Z)
cli.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExW@24 referenced in function "private: static bool __cdecl VM::gamarue(void)" (?gamarue@VM@@CA_NXZ)
cli.obj : error LNK2019: unresolved external symbol __imp__SHGetSpecialFolderPathA@16 referenced in function "private: static bool __cdecl VM::kvm_directories(void)" (?kvm_directories@VM@@CA_NXZ)
cli.exe : fatal error LNK1120: 7 unresolved externals
There is an easy mitigation - instruct the linker using pragma, so all become happy
for some (tricky) cases one might need to build hes/her code from the VC++ command line in this case the linker is not happy, eg:
There is an easy mitigation - instruct the linker using pragma, so all become happy
Please consider this PR: https://github.com/kernelwernel/VMAware/pull/37