It's been a long while since I've written C++ but I have no clue why this is not compiling. It's VERY straightforward.
using namespace std;
template<class IDX, class TYPE>
class ActiveMap
{
public:
ActiveMap(){}
private:
map<IDX, TYPE> idMap;
};
I am getting a
ISO C++ forbids declaration of 'ActiveMap' with no type
even when I change the map declaration to a simple map<int, int>
I get the same thing. I know there are many questions regarding this but this is too much of a simple example.
I am attempting to compile with g++ -c ActiveMap.cpp
and so will not compile against my main.cpp. BUT....
main.cpp
#include "ActiveMap.h"
int (int argc, char* argv[]) {
ActiveMap<int, float> map;
map[2] = 3.2;
return 0;
}
That's it.
How can I compile ActiveMap.cpp with g++?
Comments
Post a Comment