Undeclared Identifier with all the right includes

346 views Asked by At

Everytime I try to build the program I get this error:

error C2065: 'DepositoFresco' : undeclared identifier

This happens with every instance I create of DepositoFresco, DepositoNormal and Deposito. DepositoNormal and DepositoFresco are subclasses of Deposito (virtual class). I have all the right includes so I don't know what's causing this. The error occurs in the class 'Armazem' where I instantiate several of these to insert in vectors and such. Here's the code:

Armazem::Armazem(int nF, int nN, int nPF, int nPN, int distMaxi, int distMini) : depositos(), distancia(), graphStlPath <Deposito*, int>() {
distMax = distMaxi;
distMin = distMini;

for (int i = 0; i < nF; i++) {
    DepositoFresco* df = new DepositoFresco(random(1, 20), (float)random(1000, 10000), nPF);
    depositos[i] = df;
}

for (int j = nF; j < nF + nN; j++) {
    DepositoNormal* dn = new DepositoNormal(random(1, 20), (float)random(1000, 10000), nPN);
    depositos[j] = dn;
}

preencherMatriz();
}

Also, Armazem is a subclass to another template class called GraphStlPath but I don't think the problem is here.

EDIT: Here are the includes:include "Deposito.h" include "DepositoFresco.h" include "DepositoNormal.h" include "graphStlPath.h" include <vector> include <map> include <stdlib.h> include <stdio.h> include <time.h> include <typeinfo> include <iostream> include <fstream> include <string>

Any help finding the problem is really apreciated.

1

There are 1 answers

1
Sebastian Redl On BEST ANSWER

My psychic debugging powers tell me that you have a cycle in your includes, and header guards or #pragma once are kicking in, making code disappear for the compiler.

That, or you are not respecting namespaces. But the first one is more likely.