add clr support to ATL project
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: add clr support to ATL project

  1. #1
    Join Date
    May 2010
    Posts
    20

    add clr support to ATL project

    Hello,

    I created a ATL/COM c++ project and I tried to add clr support to this. Unfortunately I run into some linker errors here.

    I'll explain shortly what I did so maybe someone can can tell me how to solve this. I am using VS2005.

    First I created a ATL project (dll) with the wizard. Everything default, nothing special. After that I removed the proxy/stub project, because I don't need it. Then I added a Simple ATL object to the class. I built it and it worked.

    Then I added clr support to the project. After the build I got the linker error:
    Command line error D8045 : cannot compile C file '.\TestATLProject_i.c' with the /clr option
    so I entered the properties of that generated file and chose the option "Compile as C++ Code (/TP)"

    After the next build the previous error was gone but I get the following new linker errors and I don't know how to handle this:

    1>AtlTestClass.obj : error LNK2020: unresolved token (0A00004A) LIBID_TestATLProjectLib
    1>TestATLProject.obj : error LNK2020: unresolved token (0A000064) LIBID_TestATLProjectLib
    1>AtlTestClass.obj : error LNK2020: unresolved token (0A00004B) IID_IAtlTestClass
    1>TestATLProject.obj : error LNK2001: unresolved external symbol _LIBID_TestATLProjectLib
    1>AtlTestClass.obj : error LNK2001: unresolved external symbol _LIBID_TestATLProjectLib
    1>AtlTestClass.obj : error LNK2001: unresolved external symbol _IID_IAtlTestClass

    I would appreciate if anyone can tell me how to deal with this.

    Best regards
    Last edited by Makiman; August 7th, 2011 at 01:00 AM.

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,632

    Re: add clr support to ATL project

    cannot compile C file ... with the /clr option doesn't it say it all?
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    10,965

    Re: add clr support to ATL project

    What are you trying to accomplish by building ATL with clr?

  4. #4
    Join Date
    May 2010
    Posts
    20

    Re: add clr support to ATL project

    I would like to have a COM dll which can use managed and unmanaged libraries. And not only exported c style functions via P/Invoke.

  5. #5
    Join Date
    May 2010
    Posts
    20

    Re: add clr support to ATL project

    now I created a COM dll without the wizard like here:
    http://msdn.microsoft.com/en-US/libr...(v=VS.80).aspx

    And it worked immediately with clr support!

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center