CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Threaded View

  1. #1
    Join Date
    Aug 2011

    Library and Template Trouble

    Hi all,

    I am trying to implement a generic smart pointer library which links to another main program. To make the smart pointer library generic I am using a template with a typename called "type". However, when I attempt to link my library to the main program and compile them both, I get a compiler error which says something like "Expected type, got link" (where "link" is a class in the main program).

    I was wondering why this is happening and what I can do to fix it. I've tried passing my smart_pointer an "int" type and this works fine.

    For example:

    smart_pointer<int> p = new int(); // Works okay!


    smart_pointer<link> l = new link(); // Does not work! (Compiler: "Expected type, got link")

    I've included my code below (not all of it, but just the parts I think are relevant). Also, I'm not supposed to alter the main program in any way (just my library).

    Any help would be greatly appreciated.


    EDIT: Please refer to the code on the third post below this one.
    Last edited by ace_of_pentacles; September 6th, 2011 at 09:16 PM. Reason: Updating inadequate code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.