Hello, where is the problem in this code? it seems ok but i get "unresolved external symbol " error" for Server::SetMode() :/ damn

// Server.h

class Server
{
    public:
        Server();
        static const int MODE_NONE = 1;
        static int SERVER_MODE;
        void SetMode();
};




// Server.cpp
#include "Server.h"

Server::Server()
{

}

void Server::SetMode()
{
  SERVER_MODE = MODE_NONE;
}

Hey

I don't know if this would work, but try it..

class Server {

    public: 
        Server();
        void SetMode();
    protected:
      static const int MODE_NONE;
      static int SERVER_MODE;

};

Also, in your class functions:

// set the mode in your main
void Server::SetMode(int theModeNone)
{
  SERVER_MODE = theModeNone;
}

// then in main
// have something like this:

Server s;

s.setMode(1);

Hope this helps, in your classes, try splitting the functions/variables seperately (Like the example) and using private/protected

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.