From the hint "// Also set /clr compile option in the project
properties" it sounds C++/CLI related to me. Despite the misleadingly
similar name, that's an entirely different language.
Keep digging, and all the knowledgeable posters here will surely push
you into the resulting pit, or their killfiles.
Did you read this part of the FAQ?
"Include the smallest, complete and compilable program that exhibits
That would as a minimum have included the definition of your "lock"
class or function, or whatever it is, since it is not a part of the C++
standard and nobody here can read minds.
I'm still stunned because the impression I get is that this group has
blinders on and is only able to talk about the language from a
language design perspective, having never coded something like what I
am attemping in C++. I find it hard to believe - most people are more
advanced than the simple concept I'm trying, from what I gather.