
Originally Posted by
Shadowfiend
Sorry, I made a mistake in my template declaration. Try:
namespace std { template <class T> class vector; }
namespace std { template <class T> class vector; }
To copy to clipboard, switch view to plain text mode
That compiles fine on my computer.
Maybe it can be the solution; but then, my problem is in a other place; try to compile this ,please (It doens't compile on .net2005)
//main.cpp
#include <iostream>
#include "forward.h"
#include <vector>
using namespace std;
int main (int argc, char argv[]) {
Forward f;
vector<float>* fvec = new vector<float>; //EDIT <----------------------------
return EXIT_SUCCESS;
}
//forward.h
#ifndef FORWARD_H
#define FORWARD_H
namespace std { template <class T> class vector; }
// #include <vector> // with only this, all compiles
class Forward {
std::vector<float>* _vec;
public:
Forward();
~Forward();
};
#endif FORWARD_H
//forward.cpp
#include "forward.h"
#include <vector>
using namespace std;
Forward::Forward() {
_vec = new vector<float>;
}
Forward::~Forward() {}
//main.cpp
#include <iostream>
#include "forward.h"
#include <vector>
using namespace std;
int main (int argc, char argv[]) {
Forward f;
vector<float>* fvec = new vector<float>; //EDIT <----------------------------
return EXIT_SUCCESS;
}
//forward.h
#ifndef FORWARD_H
#define FORWARD_H
namespace std { template <class T> class vector; }
// #include <vector> // with only this, all compiles
class Forward {
std::vector<float>* _vec;
public:
Forward();
~Forward();
};
#endif FORWARD_H
//forward.cpp
#include "forward.h"
#include <vector>
using namespace std;
Forward::Forward() {
_vec = new vector<float>;
}
Forward::~Forward() {}
To copy to clipboard, switch view to plain text mode
Bookmarks