problem when compiling
HuntFrank opened this issue · 8 comments
i always get this error,i tried lots of ways,if i just copy this file to the project ,i will get more error.
error C1083 can't open: “capstone.h”: No such file or directory DdiMon C:\Users\hunter\Desktop\fdssd\DdiMon-master\DdiMon\shadow_hook.cpp 21
i do not know how to include this file ,can you help me
Did you clone submodules?
git clone --recursive https://github.com/tandasat/DdiMon.git
when i did as you say,i got those errors and i have no idea where the problem is.my visual studio is 2019.can you help me?
error LNK2019 Unresolved external symbol _invoke_watson,The symbol in the function "protected: virtual void __cdecl stdext::bad_alloc::_Doraise(void)const " (?_Doraise@bad_alloc@stdext@@MEBAXXZ) Referenced DdiMon C:\Users\hunter\Desktop\myhv\new\DdiMon\DdiMon\shadow_hook.obj 1
error LNK2001 Unresolved external symbol "void (__cdecl* std::_Raise_handler)(class stdext::exception const &)" (?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA) DdiMon C:\Users\hunter\Desktop\myhv\new\DdiMon\DdiMon\shadow_hook.obj 1
It turned out that it is no longer possible to use the C++ standard library in the kernel mode with only _HAS_EXCEPTION 0
with VS 2019.
I was able to compile the project by adding those missing definitions. I do not know what the implication of this exactly but you can try and play with the project.
// in shadow_hook.cpp
////////////////////////////////////////////////////////////////////////////////
//
// implementations
//
EXTERN_C
_ACRTIMP void __cdecl _invoke_watson(
_In_opt_z_ wchar_t const* _Expression,
_In_opt_z_ wchar_t const* _FunctionName,
_In_opt_z_ wchar_t const* _FileName,
_In_ unsigned int _LineNo,
_In_ uintptr_t _Reserved)
{
}
namespace std { _Prhand _Raise_handler; }
Thank you very much.I solved this error
Hi @HuntFrank
Can you please described how did you sove it? (I am facing the same error)
Nevermind. I wrongly added ucrtd library. Now it builds.
LNK2001 "void (__cdecl* std::_Raise_handler)(class stdext::exception const &)" (?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA).
How to fix it?
Since google appears to be pointing to this and there appears to be an issue with the latest Visual Studio version, I'm going to resurrect this issue. Sorry about that.
I was consistently able to resolve the issue by not using /std:latest
but rather /std:c++20
(which to me is less limiting than having to enable exceptions and the problems exception handling can cause with the Address Sanitizer).
Hope this helps someone.