Unresolved externals - please help before I throw my laptop away

This is a discussion on Unresolved externals - please help before I throw my laptop away within the C++ Programming forums, part of the General Programming Boards category; Hi all...
Second thread start in 24 hours... :-S
I'm having a nightmare trying to get the below code to ...

Unresolved externals - please help before I throw my laptop away

Hi all...

Second thread start in 24 hours... :-S

I'm having a nightmare trying to get the below code to link, I keep getting unresolved externals errors from the linker. It seems to be related to use of the overloaded operator << in the "main" function, which is being used to print each object in an array created from a template.

Apologies for the looooong code... thought best to just print the lot rather than being asked for it later!...

I've been over the code with a fine tooth comb - I can't find any typos or something that would cause functions declarations not to match with their definitions (although I've just copy/pasted this from Visual Express so don't be surprised if I've accidentally deleted a semi colon or something). Please help me before I throw my rather nice laptop out the lounge window....

Also can anyone give me any tips for tracking down linker errors? Visual Express can't track them down in the same way it can with complier errors... cheers :-)

It is not that easy to track down linker errors, as you have discovered. That's mainly because the compiler doesn't actually tell the linker where the source code came from that asks for that particular function. Not much we can do about that, unfortunately.

Trying to understand what the function is that is missing will definitely help.

In this case, the problem is clearly that for whatever reason, the compiler doesn't want to instantiate

Sorry you're speaking to a bit of a noob here (looks embarassed!!) are you saying there's something wrong with my array constructor? And is this why I'm having my unresolved externals problem? If so why?

The linker error appeared to result from these warnings concerning the friend operator<< declaration:

52: warning: friend declaration `std::ostream& operator<<(std::ostream&, const Array<T>&)' declares a non-template function
52: warning: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning