Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


C++ CLI -- link errors ... which constructor can't it find?

Posted on 2009-05-18
Medium Priority
Last Modified: 2012-05-07
I got past the compile errors on my conversion from managed extensions for C++(.Net 1.1) to C++ CLI (.Net 2+).

Now i have several link errors like the one below.

.cctor is a constructor, right?  How do i know which constructor it can't find?

Error	27	error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)	MyClass.obj	MyLibrary

Open in new window

Question by:Daniel Wilson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 40

Expert Comment

ID: 24412024
>> cctor is a constructor, right?

>> How do i know which constructor it can't find?
Looking at the linker error I'd guess it's looking for a default constructor.
LVL 44

Accepted Solution

AndyAinscow earned 1800 total points
ID: 24412028
From help about LNK2001:

When upgrading a managed library or web service project from Visual C++ 2003  to Visual C++ 2005, the /Zl compiler option will added to the Command  Line property page. This will cause LNK2001. Remove /Zl from the  Command Line property page to resolve. See /Zl (Omit Default Library  Name) and How to: Open Project Property  Pages for more information. Or, add msvcrt.lib and msvcmrt.lib to  the linker's Additional Dependencies property.

Is that your problem?
LVL 32

Author Comment

by:Daniel Wilson
ID: 24412282
/Zl is not my problem as that is on neither the compiler command line nor the linker command line.

And I have a default constructor:
  //set a class-level boolean

More ideas?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 40

Assisted Solution

evilrix earned 200 total points
ID: 24412320
Actually, cctor is probably a copy constructor (sorry, I read it wrong). Look for a definition of

MyClass::MyClass(MyClass &)


MyClass::MyClass(const MyClass &)

Are you trying to create a copy of a class that has noncopyable semantics (ie, copy constructor declared but not defined)?
LVL 32

Author Comment

by:Daniel Wilson
ID: 24412424
No, there's no copy constructor for any of the classes about which it's complaining.
LVL 40

Expert Comment

ID: 24412441
>> No, there's no copy constructor for any of the classes about which it's complaining.
As in no declaration nor implementation or just no implementation?
LVL 32

Author Comment

by:Daniel Wilson
ID: 24412475
No declaration nor implementation.

In these particular classes, a copy constructor would just make no sense.  So we never declare one.
LVL 32

Author Comment

by:Daniel Wilson
ID: 24434529
Andy, you were right.  The /Zl was not in the huge block of command-line options, but was in the "Additional Options" section.


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question