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

Don't repeat the static keyword in the definition of getWindowCount.

D'oh! I thought I'd already done tried that. Thanks. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.