I am trying to compile a Visual Studio / C++ code snippet I have found on the internet containing the function:
Marshal::SizeOf()
When compiling the snippet, I get the error message:
error C2653: 'Marshal' : is not a class or namespace name
so I think I need to include a header file with the definition of this namespace or class, and the SizeOf() function.
When I look up Marshal::SizeOf C++ in Google I find this help page, however on this page there is no information regarding which header file must be included in order to use this function.
Is there a documentation page where one can look up all .NET classes and functions and easily find the C++ header file that must be included in order to use them?
You need to understand what C++/CLI is. It is a proprietary extension to C++ by Microsoft to make the interfacing between native and managed code (i.e. .Net) easy.
Marshalis not a C++ class, it’s a C++/CLI class. As such, there’s no header to include. It’s#importyou are looking for.