Perhaps this is a heading issue ... But here's what happens:
The compiler gives me an error in the line:
Queue<Email> mailbox;
This is mistake:
..\EmailSystem.h:25: error: ISO C++ forbids declaration of `Queue' with no type ..\EmailSystem.h:25: error: expected `;' before '<' token
Queue.h:
#ifndef QUEUE_H_ #define QUEUE_H_ #include <string> #include "EmailSystem.h" ... template <class B> class Queue { ... }; #endif /* QUEUE_H_ */
Queue.cpp:
#include "Queue.h" ... template class Queue<Email>;
EmailSystem.h:
#ifndef EMAILSYSTEM_H_ #define EMAILSYSTEM_H_ #include <iostream> #include <string> #include <vector> #include "Queue.h" struct Email { ... }; struct User { std::string name; Queue<Email> mailbox; }; ... #endif /* EMAILSYSTEM_H_ */
source share