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

Threaded View

  1. #4
    Join Date
    Sep 2005
    Posts
    5

    Re: Mixing managed and standard classes in a static library

    Now I'm confused. I started from the very begining again.

    1) I created a new blank solution;
    2) added a new "Console (.NET)" project called "Console", and a new "Class Library (.NET)" project called "Library";
    3) changed the configuration type of the "Library" project form "dynamic library" to "static library";
    3) edited "console.cpp" to use the "Class1" class:

    #include "stdafx.h"
    #include "..\Library\Library.h"
    #using <mscorlib.dll>
    using namespace System;

    int _tmain()
    {
    Library::Class1* class1 = new Library::Class1;
    return 0;
    }

    4) built the solution and it worked.
    5) Then I explicity defined the constructor of Class1 (with the implementation in the .cpp file);
    6) I built the solution and I got

    LINK : error LNK2020: unresolved token (06000002) Library.Class1::.ctor

    Adding "Library.lib" (the file generated when building the "Library" project) to "aditional dependencies" in the "Console" project properties doesn't change the results.
    Doubtlessly, I'm missing something. This should be simple. Here I am not mixing managed and standard classes. There is only a single managed class (Class1). Please help me.
    Last edited by InMune; September 6th, 2005 at 04:12 PM.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured