Cannot find default constructor to initialize array element of type 'XXX'
you need default constructor because you are going to use it to create default instances of your class in this staement:
XXX* arr = new XXX[50];
probably you have implemented another constructors, some with arguments and this is why a default constructor was not auto generated by the compiler for you. It might looks like this:
class XXX{
public:
XXX(){}
};
Next:
When i just declare the following in xxx.cpp file
XXX* arr[50];
i get some error messages in other cpp files like
Undefined symbol arr;
you need an extern
declaration still in header to resolve the symbol in other translation units. This is what C++03 standard says what they are:
The text of the program is kept in units called source files in this International Standard. A source file together with all the headers (17.4.1.2) and source files included (16.2) via the preprocessing directive #include, less any source lines skipped by any of the conditional inclusion (16.1) preprocessing direc- tives, is called a translation unit. [Note: a C++ program need not all be translated at the same time. ]