Sign in to follow this  
TroneX

'extern' not allowed after class or struct

Recommended Posts

I am trying to compile a library with a mingw compiler (from DevC++) and get the following error: "storage class specifier `extern' not allowed after struct or class" The line reads like this:
class LUAPLUS_CLASS LuaObject
{
public:
    (...)
}


with LUAPLUS_CLASS being defined like this:
    #ifndef LUA_API
        #define LUA_API extern
    #endif
    #ifndef LUAPLUS_CLASS
        #define LUAPLUS_CLASS LUA_API
    #endif


Well,... it is obvious, that the compiler doesn't like a "class extern LuaObject", but what am I supposed to do now? Regards, T.

Share this post


Link to post
Share on other sites
You don't extern a class, you extern variables.
// variable declaration
extern int i;

// class declaration
class SomeClass;

// variable definition
int i;

// class definition
class SomeClass
{
// member & static functions & variables
};


Enigma

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this