Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LNK2001 error after conversion fro FX 1.1 to FX 2.0

540 views
Skip to first unread message

Urs Vogel

unread,
Dec 1, 2005, 1:37:43 PM12/1/05
to
Hi

I have a C++ interop project, which links fine with VS2003, but after
converting it to VS2005, it compiles everything withour errors/warnugs, but
I get the following linker message.

DBRDMUM.obj : error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ)

I definitely don't have a method named like this, so it must be some
compiler created symbol, but I really don't know what to look for. Any
hints? Thanks a lot.

Urs


Holger Grund

unread,
Dec 1, 2005, 2:18:14 PM12/1/05
to
"Urs Vogel" <uvo...@msn.com> wrote

>
> I have a C++ interop project, which links fine with VS2003, but after
> converting it to VS2005, it compiles everything withour errors/warnugs,
> but I get the following linker message.
>
> DBRDMUM.obj : error LNK2001: unresolved external symbol
> "?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
>
That's the module initializer. (In fact, it's the mangled name for
void __clrcall __identifier(".cctor")(); )
It is like static constructor but not associated with a particular
class. The module initializer is executed, once the assembly is
loaded (It's similar to DllMain)

VC uses it for dynamic initialization. E.g.:

// global scope
int foo();
int i = foo();

i is initialized at load time. The compiler creates a special
function (the dynamic initializer for i). Additionally it will
emit a "/include" linker directive for the module
initializer in the object file and the /DEFAULTLIB for the
managed CRT.

When the linker sees the directive, it includes the module
initializer even if it is not otherwise referenced. It is
defined in the managed CRT.

So what you need is the correct libraries. In VC 8 it is
no longer necessary to use /NOENTRY, /NODEFAULTLIB
(linker) or /Zl (compiler) etc. Just let the tool chain figure it out.

Dumpbin /DIRECTIVES should reveal the implied
linker switches for a given object file.

If that doesn't help can you post linker warnings and
the result of dumpbin /DIRECTIVES along with
the command line switches for the linker and compiler?

-hg

Urs Vogel

unread,
Dec 1, 2005, 4:39:06 PM12/1/05
to
Found it out. Removed /Zl, removed msvcrt.lib from dependecies, removed /noentry. Works now. Your hints brought me on path. Thanks.
 
 
"Urs Vogel" <uvo...@msn.com> schrieb im Newsbeitrag news:%23DXigpr...@TK2MSFTNGP14.phx.gbl...
Hi Holger

Thanks for your hints. Dind't really help me any farther, dumpbin
/Directoves list and build log are in the attachment.

Any tips are appreciated ... Thanks.

"Holger Grund" <holger...@remove.ix-n.net> schrieb im Newsbeitrag
news:u5UaArq9...@TK2MSFTNGP15.phx.gbl...
0 new messages