MSVC Code Analysis failure
#1
I tried MSVC's Code Analysis, but it fails to compile the server:
src\BlockInfo.h(34): error C2248: 'cBlockInfo::~cBlockInfo' : cannot access protected member declared in class 'cBlockInfo'

The relevant source:
static cBlockInfo & Get(BLOCKTYPE a_Type)
{
	static cBlockInfo ms_Info[256];
	static bool IsBlockInfoInitialized = false;
	if (!IsBlockInfoInitialized)
	{
		cBlockInfo::Initialize(ms_Info);
		IsBlockInfoInitialized = true;
	}
	return ms_Info[a_Type];
}  // Error reported here
Anyone got an idea why? The code compiles fine when Code Analysis is turned off again.
Reply
Thanks given by:
#2
The problem is, as the error says, "cBlockInfo" is protected.
I told you, that that's a problem for the Code Analysis tool from the MCVS a while ago. :/
It works without a problem, when you make it public.
(remove "protected:" at line 89)
Reply
Thanks given by: PCPlayerLV , Francisdaumb




Users browsing this thread: 2 Guest(s)