Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


'CComPtr' : use of class template requires template argum

'CComPtr' : use of class template requires template argum

'CComPtr' : use of class template requires template argum

Hello folks,
I am newbie to ATL/COM programming!!!! I am trying to add a COM dll in Visual C++ for PocketPC 2002. So i took a simple hello world program and tried to instantiate an object of one of the interfaces in the dll. I am not able to compile. Looks like I am getting an error in trying to initialize using CComPtr. Would really appreciate your help.!!!!

I have attached the code here and also the compile errors. I am hard pressed with time to finish this. I am not able to proceed further. Would really appreciate any help you can give.

I have also included atlbase.h
CComPtr <IReader> pMobileObj;
// creating a MobileObj object
HRESULT hr =pMobileObj.CoCreateInstance(CLSID_Reader);

Compile errors:
C:\SMM6.4\POCKETPC\VC++\Test\Test.cpp(159) : error C2065: 'IReader' : undeclared identifier
C:\SMM6.4\POCKETPC\VC++\Test\Test.cpp(159) : error C2955: 'CComPtr' : use of class template requires template argument list
        C:\Windows CE Tools\wce300\Pocket PC 2002\atl\include\atlbase.h(674) : see declaration of 'CComPtr'
C:\SMM6.4\POCKETPC\VC++\Test\Test.cpp(159) : error C2133: 'pMobileObj' : unknown size
C:\SMM6.4\POCKETPC\VC++\Test\Test.cpp(159) : error C2512: 'CComPtr' : no appropriate default constructor available
C:\SMM6.4\POCKETPC\VC++\Test\Test.cpp(159) : error C2262: 'pMobileObj' : cannot be destroyed
C:\SMM6.4\POCKETPC\VC++\Test\Test.cpp(161) : error C2065: 'CLSID_Reader' : undeclared identifier


RE: 'CComPtr' : use of class template requires template argum

The first error says it all - 'IReader': undeclared identifier.  You probably forgot to include the header file that defines IReader.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close