Reputation: 45
I am writing a small program, for a school project, that emulate a shared editor (like Google Docs)
I've written all the classes that I need but when I try to build the program I get this errors:
error: unknown type name 'NetworkServer'
NetworkServer &_server;
error: use of undeclared identifier 'SharedEditor' std::vector<SharedEditor*> SEditors;
error: expected expression std::vector<SharedEditor*> SEditors;
error: unknown type name 'SharedEditor' int connect(SharedEditor* sharedEditor);
Here are my .h files
NetworkServer.h
#include <vector>
#include <queue>
#include "SharedEditor.h"
#include "Message.h"
class NetworkServer {
private:
std::vector<SharedEditor*> SEditors;
std::vector<int> idEditors;
std::queue<Message> messages;
public:
int connect(SharedEditor* sharedEditor);
int disconnect(SharedEditor* sharedEditor);
void send(const Message& m);
void dispatchMessages();
};
SharedEditor.h
#include "NetworkServer.h"
#include "Message.h"
#include "Symbol.h"
class SharedEditor {
private:
NetworkServer& _server;
int _siteId{};
std::vector<Symbol> _symbols;
int _counter;
public:
SharedEditor() = delete;
SharedEditor(NetworkServer& server);
void localInsert(int index, char value);
void localErase(int index);
void process(const Message& m);
std::string to_string();
int getSiteId() const;
};
Symbol.h
#include <vector>
class Symbol {
private:
char value;
int idClient;
int num;
std::vector<int> pos;
public:
Symbol(char value, int client, int num, std::vector<int> pos);
char getValue() const;
int getIdClient() const;
int getNum() const;
const std::vector<int> &getPos() const;
};
Message.h
#include <vector>
class Message {
bool insert; // true --> insert || false --> delete
int _siteId;
int num;
char value{};
std::vector<int> pos;
public:
Message(bool insert, int siteId, int num, char value, std::vector<int> pos);
Message(bool insert, int siteId, int num);
bool isInsert() const;
int getSiteId() const;
int getNum() const;
char getValue() const;
const std::vector<int> &getPos() const;
};
I don't understand where I am doing something wrong. BTW I am using CLion
Upvotes: 0
Views: 1244