Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7542625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:13:01+00:00 2026-05-30T08:13:01+00:00

I see on a question that it wasn’t possible to link a static C++/CLI

  • 0

I see on a question that it wasn’t possible to link a static C++/CLI library, so I generated a dynamic one and try to link it in a C++ CLR console project with no success
I get:
Error 1 error LNK2020: unresolved token (06000001) cBox::.ctor pTest9.obj
I put the dll (Project ->reference->add new reference) set the include files in the project
(include file with no code)

I don’t know what to do (I am new with the C++/CLI)

thanks for suggestions/solution

Library Project declared as DLL

#include "stdafx.h"

using namespace System;

ref class cBox
{
public:
cBox() ;
cBox(double lv,double bv,double hv);

double Volume();

private:
double Length;
double Width;
double Height;
};

CODE OF THE LIBRARY :

#include "stdafx.h"
#include "cBox.h"


cBox::cBox() 
{
Console::WriteLine(L"No arg constructor called");

Length  = 1.0 ;
Width       = 1.0 ;
Height  = 1.0   ;

}

cBox::cBox(double lv,double bv,double hv)
{
Console::WriteLine(L"Constructor called");

Length  =   lv;
Width       =   bv;
Height  =   hv;

}
double cBox::Volume()
{
    return Length*Width*Height;
}

Then in the Console CLR Project I try to link this library, I get its .h file

#include "stdafx.h"
#include "cBox.h"

using namespace System;


int main(array<System::String ^> ^args)
{

Console::WriteLine(L"Test Library:\n");

cBox^ oBox; // handle of type box

oBox = gcnew cBox;

Console::WriteLine(L"Default Box Volume {0}",oBox->Volume());

  return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:13:02+00:00Added an answer on May 30, 2026 at 8:13 am

    You need to make a couple of changes to get this to work. First, you need to make the class public so your application can use it:

    public ref class cBox
    {
        ...
    

    And you need to remove the #include "cBox.h" from your console application project; the inclusion is implicit when using managed libraries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this question I see that microsoft ships the XML documentation files for the
I see this question here on SO but I am not sure that answers
ORIGINAL (see UPDATED QUESTION below) I am designing a new laboratory database that tests
From the description of sn.exe utility and this question I see that a copy
I see that over on this question LINQy way to check if any objects
I was suprised to see FxCop complaining that I wasn't specifying a CultureInfo in
I see that the above question was asked earlier, however even after referring them
my last question was closed because it wasn't clear, so I'll try again because
I often see people asking XML/XSLT related questions here that root in the inability
There maybe some simlar questions to this but I can't see anything that really

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.