Thanks for the reply. I've run into a problem that I want to debug with Code::Blocks (as opposed to either using gedit and gdb or Emacs and gdb). I am able to compile my code fine in Fedora 15, but not when using Code::Blocks (using GCC compiler). I am assuming my problem might be because I am separating a template class into a .h and .cpp file.
Anyway the structure of my code is as follows:
MyVector.h
MyVector.cppCode:#ifndef MYVECTOR_H #define MYVECTOR_H template <typename T> class MyVector { public: MyVector(); // Remaining Class Declarations }; #include "MyVector.cpp" #endif // MYVECTOR_H
The error messages I am getting are:Code:#include "MyVector.h" template <typename T> MyVector<T>::MyVector() { capacity = 10; vect_front = 0; vectsize = 0; vector = new T[capacity]; } // Remaining functions
Any idea why I am getting the above error messages with Code::Blocks? Any idea why I am able to compile this under Fedora without running into these errors? If you need to entire code, let me know. Thanks for any assistance.Code:error: redefinition of 'MyVector<T>::MyVector()' error: 'MyVector<T>::MyVector()' previously declared here




Reply With Quote