0

Hey guys, I'm getting this kinda vague error:

Zeal\src\window.cpp|19|error: cannot declare member function `static unsigned int zeal::window::getWindowCount()' to have static linkage|

With the following code (only what I think is needed, if you need more please do ask)

window.h

namespace zeal {
class window : public element
{
    public:
    static unsigned int getWindowCount();

    private:
    static unsigned int windowCount;
};
}

window.cpp

unsigned int zeal::window::windowCount = 0;

namespace zeal {
    static unsigned int window::getWindowCount(){
        return windowCount;
    }
}

It's only called once from main, I want to call it like this:

main.cpp (one line only)

cout << "Nr of windows: " << window::getWindowCount() << endl;

Any help is much appreciated as usual,
Nick

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Clockowl
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.