Linker error

J

Jack

Hi there,

I downloaded a small sample solution (DLL) from PayPal and I'm getting the
following error when I compile it:

Error 2 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ) ButtonEncryption.obj ButtonEncryptionLib

This occurs several twice in fact (for this file) and once for "stdafx.obj".
The code was upgraded by VS 2005 when I first loaded the solution (from
whatever earlier version it came from) but it should work AFAIK (same
problem occurs in VS 2008). The error indicates that some runtime support
library appears to be missing since it involves the constructor but there's
only one class in the file and its constructor is present. I'm an
experienced C++ developer but have no background in managed C++. Does anyone
recognize what library it may be looking for. Thanks.
 
J

Jack

Error 2 error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"

Sorry, the error should read:

error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ) in ButtonEncryption.obj
This occurs several twice in fact (for this file) and once for
"stdafx.obj".

Kill "several"
 
C

Cholo Lennon

Jack said:
Sorry, the error should read:

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


Kill "several"

Demangling name (using undname utility) you have the following:

"void __clrcall cctor(void)"

In MSIL cctor is a special name for static ctors (type initializer).
Something like that

ref class Test
{
public:
static int foo;

// cctor (check this name with ILDasm)
static Test()
{
foo = 17;
}
};

For classes with static data, type initializers are optional: If you don't
provide it, the compiler always generates one with default init values.
In your code: if a class provide a declaration for cctor, check the
existence of its definition.

Regards
 
J

Jack

Demangling name (using undname utility) you have the following:
"void __clrcall cctor(void)"

In MSIL cctor is a special name for static ctors (type initializer).
Something like that

ref class Test
{
public:
static int foo;

// cctor (check this name with ILDasm)
static Test()
{
foo = 17;
}
};

For classes with static data, type initializers are optional: If you don't
provide it, the compiler always generates one with default init values.
In your code: if a class provide a declaration for cctor, check the
existence of its definition.

Thanks for the feedback (sorry for the delay in responding). This is good to
know but it doesn't apply unfortunately since there are no static members at
all. Maybe it applies in some other esoteric way (or perhaps there's some
static member behind the scenes somewhere) but I gave up on the problem
after creating a new project and migrating the code to it. That fixed things
so I'm not going to bother tracking it down (it's PayPal's code so I'm not
going to worry about it now that it's working). Note BTW (FWIW) that it
still relies on "_gc". Anyway, thanks again for your help (appreciated).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top