0

I can`t cope with the following situation:

class someName
{ public:
vector<compound_objectNS::Compound_object*> loadObjectsFromFile(char* fileName);
}

namespace compound_objectNS
{ class Compound_object {here goes it`s defenition}.
}

I get error from isense: "vector is not a template" What I am doing wrong? Help me please! Thanks in advance.

spin_eight
  • 3,925
  • 10
  • 39
  • 61
  • 3
    with such basic problems (missing forward declarations, missing include files, missing namespace selectors, using char* instead of std::string, missing semicolon after class declaration, missing include guards) I sincerely recommend getting [a good C++ book](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list), and I mean it honestly, it will save you a lot on your path forward. – Sebastian Mach Aug 06 '12 at 15:52
  • yes, thank you for you suggestion, but I was unattentive and forgot about using std. As my working day is almost over sometimes stupid mistakes rise, but again thnx for suggestion )) – spin_eight Aug 06 '12 at 15:57

2 Answers2

1

You need to #include <vector> before using std::vector<>.

Sebastian Mach
  • 38,570
  • 8
  • 95
  • 130
  • Thank you! I ommited std: and that is why isense reported on error. I shall accept you answer after 20 min. – spin_eight Aug 06 '12 at 15:54
  • @spin_eight: If that was your sole problem, I highly recommend to copy+paste relevant code instead of transcribing it wrongly ;) – Sebastian Mach Aug 06 '12 at 15:57
0

If you didn't write using namespace std; or some similar using directive, you should write std::vector. Or maybe you simply forgot the #include <vector> at the beginning of the file.

Also, you have to provide a declaration for compound_objectNS before declaring that vector (either a full definition, either a forward declaration).

Matteo Italia
  • 123,740
  • 17
  • 206
  • 299