Reputation: 354
In my C++/CLI library, I am getting the compiler error:
error C2065: 'NULL' : undeclared identifier
Why is this happening? Note: I am setting the value of an unmanaged pointer to NULL, not a managed clr object pointer.
I know that I could just define NULL
as 0, but that doesn't answer why this is suddenly happening. I am using NULL
in other places, and things work fine.
If I add Windows.h
to my stdafx.h include file, then I get warnings about a mismatch in the stdlib versions being linked with other dlls.
Why am I suddenly having issues using NULL
?
Also, is it true that I can use nullptr
for unmanaged types as well as managed?
EDIT: It seems that the answer to whether nullptr
can be used for unmanaged types is yes. So I think that the answer is to just start using nullptr
.
https://msdn.microsoft.com/en-us/library/4ex65770.aspx
Upvotes: 0
Views: 836