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

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

LVL 32
Daniel WilsonAsked:
Who is Participating?
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
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?
evilrixSenior Software Engineer (Avast)Commented:
>> 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.
Daniel WilsonAuthor Commented:
/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?
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

evilrixConnect With a Mentor Senior Software Engineer (Avast)Commented:
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)?
Daniel WilsonAuthor Commented:
No, there's no copy constructor for any of the classes about which it's complaining.
evilrixSenior Software Engineer (Avast)Commented:
>> 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?
Daniel WilsonAuthor Commented:
No declaration nor implementation.

In these particular classes, a copy constructor would just make no sense.  So we never declare one.
Daniel WilsonAuthor Commented:
Andy, you were right.  The /Zl was not in the huge block of command-line options, but was in the "Additional Options" section.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.