Consider:
static class EntranceClass {
public:
static void RegisterSomething()
{
}
static int main()
{
RegisterSomething();
return 0;
}
} // <-- Expected unqualified-id at the end
I'm getting the following error:
expected unqualified-id at end of input main.cpp Problem
Is there a solution?
main
is just main
. It is simply a function:
class EntranceClass
{
...
}; // <-- Note the semicolon
int main()
{
}
The error is referring to the use of the static
keyword before the class definition - the compiler expects a variable name after that (as in C++ there is no such thing as a static class
).
And if you want to use static int EntranceMain::main(void)
as your program's entry point, then one way to do it is to tell that to your linker, i.e., give it a full, decorated name of that function. This is highly dependent on which compiler and linker you use, so you need to refer to their documentation. But using that will probably mean you need to include the startup code (e.g., CRT initialisation).
Note that this is not so standard-compliant, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With