Originally Posted by
Daved
Can you post the code? Your explanation is confusing. You said "Its not throwing any compilation errors" but then said, "but saying Var undeclared." Isn't that a compilation error?
What file are you editing? Is it another header or a source file?
Posting the code would answer a lot of these questions.
my words might be confusing.
in paramsmap.h If I keep both #include and forward declaration of var it compiles but If I Just use either #include "var.h" or forward declaration of Var class it doesn't compile.
and here is my code.
paramsmap.h
Code:
#ifndef PARAMSMAP_H
#define PARAMSMAP_H
#include <string>
#include <map>
#include "var.h"
#include "paramsmapcore.h"
class Var;
using std::string;
using std::map;
/**
@author Neel Basu <neel@zigmoyd>
*/
class ParamsMap : public ParamsMapCore<string, Var>{
public:
ParamsMap();
~ParamsMap();
};
#endif
paramsmapcore.h
Code:
#ifndef PARAMSMAPCORE_H
#define PARAMSMAPCORE_H
#include <map>
#include <string>
//This class doesn't need the var class.
/**
@author Neel Basu <neel@zigmoyd>
*/
template <typename KeyType, typename ValueType>
class ParamsMapCore : public std::map<KeyType, ValueType>{
public:
ParamsMapCore();
~ParamsMapCore();
public:
.....
};
#include "paramsmapcore.hpp"
#endif