c++ template help

anish.thomas@teradyne.com anish.thomas@teradyne.com
Wed Aug 9 15:28:00 GMT 2006


Hello,

I am stuck and need some help.  I am taking the uWave embedded code that is
currently being compiled with Tornado 2.0 and 'porting' the code so that it
works with the new Tornado 2.2 (gcc 2.96 I believe) compiler (c++ code),
which is apparently more ANSI C++ compliant.

I am getting an error while trying to compile one of my project.  The
problem code and the error message are below:

Code:

Raw_preproc.h:
    CComQIPtr<IDspCaptureData> pIDspCaptureData;


DSPAlgsTypes.h:
template <class T, const IID* piid = 0>
class CComQIPtr
{....

where IID is:
#define IID long

Error Message:
M:\\ThomasAn_jedi_uWaveEASInstrPrivate\\igxlwc\\Platform\\Inc\\drivers\\Raw_preproc.h:55:
 could not convert template argument `0' to `const long int *'
M:\\ThomasAn_jedi_uWaveEASInstrPrivate\\igxlwc\\Platform\\Inc\\drivers\\Raw_preproc.h:55:
 ANSI C++ forbids declaration `pIDspCaptureData' with no type

I've tried a number of things but I can't get the above code to compile.  I
have also modified DSPAlgsTypes.h to the following:
extern const IID tempNull = 0;
template <class T, const IID* piid = &tempNull>
class CComQIPtr
{...

The individual files compile but it won't link.  Also, a number of other
projects (that reference DSPAlgsTypes.h) are broken.  I've also tried
casting in DSPAlgsTypes.h to the following:

template <class T, const IID* piid = static_cast<const IID*>(0)>

and

template <class T, const IID* piid =(long *) 0>

and I get the following error message:
M:\\ThomasAn_jedi_uWaveEASInstrPrivate\\igxlwc\\Platform\\Inc\\drivers\\Raw_preproc.h:55:
 `0' is not a valid template argument
M:\\ThomasAn_jedi_uWaveEASInstrPrivate\\igxlwc\\Platform\\Inc\\drivers\\Raw_preproc.h:55:
 it must be the address of an object with external linkage

Any suggestions that you can offer would be most helpful.

Best Regards,
Anish



More information about the Gcc-help mailing list