I\'m getting an undeclared identifier error and I don\'t know why. I even rewrote the complete stuff to make sure I didn\'t do a typo. Can someone tell me why I got thi
This is, as I wrote in the comments, most likely caused by your circular includes. Connection.hpp
includes LogicSimulator.hpp
which itself includes Connection.hpp
.
In your case, you don't even need the includes. For Pointers and References, a forward declaration is fine:
Connection.hpp:
#pragma once
class CircuitObject;
class LogicSimulator;
class Connection
{
public:
Connection(CircuitObject& c1, CircuitObject& c2, LogicSimulator&
simulator);
private:
int state;
CircuitObject& c1;
CircuitObject& c2;
LogicSimulator& simulator;
};
LogicSimulator.hpp:
#pragma once
#include
#include
class CircuitObject;
class Connection;
class LogicSimulator
{
public:
std::vector circuitObjects;
std::vector selectedCircuitObjects;
std::vector connections;
sf::RenderWindow Window;
void Init();
private:
void start();
void draw();
};