I’m trying to create a simple static C++ library that I can link it into a MonoTouch app and invoke the functions via MonoTouch. I’m trying to compile the static library in XCode and have this (edited since ildjarn fixes):
class MyClass
{
public:
static int Get5() { return 5; }
static int Get10() { return 10; }
};
I get the following error on the first line:
Expected ‘=’, ‘,’, ‘;’, ‘asm’ or
‘attribute‘ before ‘MyClass’
Any ideas why?
As an aside can I compile a static library in Visual Studio and link it into a MonoTouch app or is that impossible?
Member accessibility decorators are followed by a colon in C++, like labels or switch cases —
Also, accessibility decorators have no effect on namespace-scoped types in C++, so
public class MyClassis nonsensical.