Original Post
#ifndef HEADER_HPP
#define HEADER_HPP
class foo
{
// ...
} var; // Using this generates multiple definitions
extern foo var; // Using this generates undefined reference
#endif
#ifndef HEADER_HPP
#define HEADER_HPP
class foo
{
// ...
} var; // Using this generates multiple definitions
extern foo var; // Using this generates undefined reference
#endif
Quote:
Original post by AngleWyrm
Let's just pretend I'm making a templated library.
The extern reference seems to only work if I force the user to instantiate a copy within his code, which isn't really a self-contained library. I don't want to burden the user with instancing my defaults.
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more