Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 575
  • Last Modified:

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?

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

Open in new window

0
Daniel Wilson
Asked:
Daniel Wilson
  • 4
  • 3
2 Solutions
 
evilrixSenior Software Engineer (Avast)Commented:
>> cctor is a constructor, right?
Yes

>> 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.
0
 
AndyAinscowCommented:
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?
0
 
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:
MyClass::MyClass(){
  //set a class-level boolean
}

More ideas?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
evilrixSenior Software Engineer (Avast)Commented:
Actually, cctor is probably a copy constructor (sorry, I read it wrong). Look for a definition of

MyClass::MyClass(MyClass &)

or

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)?
0
 
Daniel WilsonAuthor Commented:
No, there's no copy constructor for any of the classes about which it's complaining.
0
 
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?
0
 
Daniel WilsonAuthor Commented:
No declaration nor implementation.

In these particular classes, a copy constructor would just make no sense.  So we never declare one.
0
 
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.

Thanks!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now