Managed C++ Static Link Library problem

S

Scott

We are trying to build a managed C++ static link library containing several classes which are members of a namespace. The build of this library seems to work OK. No errors.

We then try to use this library in a managed C++ application and get the following linker error.

LINK : error LNK2020: unresolved token (06000002) TestLib.TestClass::GetTemp
LINK : fatal error LNK1120: 1 unresolved externals

A verbose build listing shows that the linker is searching the lib - so it is referenced correctly in the build process.

"TestLib" is the name of the .lib file and is also the name of the namespace. "TestClass" is the name of the class and GetTemp is a method of that class.

It's the PERIOD between the namespace and the class that I believe is the problem. Its not proper namespace scoping syntax for C++. Is this a known linker problem? Is there a workaround?

Any help would be appreciated. I'm going bald over this one.

Scott L.
 
P

phil

I have the same problem.

The answer seems to be :
not supported by MS
(see one of the last threads)


phil
 
R

Ronald Laeremans [MSFT]

That is correct. Static libraries containing managed code do not work due to
the way support for IJW is implemented in the linker.

The period between the namespace is correct. It is unrelated to the scope
operator in C++ being '::'.

Ronald Laeremans
Visual C++ team
 
R

roger

Hi Ronald,

Unfortunately I have the same link problem, since I have managed code
in a static library. What options exist to solve this problem? Could
you give me any hints in this regard?

Thanks in advance.

Regards,
Roger
 
R

Ronald Laeremans [MSFT]

Moving that code to a separate assembly is the most likely workaround.

Ronald

roger said:
Hi Ronald,

Unfortunately I have the same link problem, since I have managed code
in a static library. What options exist to solve this problem? Could
you give me any hints in this regard?

Thanks in advance.

Regards,
Roger



"Ronald Laeremans [MSFT]" <[email protected]> wrote in message
That is correct. Static libraries containing managed code do not work due to
the way support for IJW is implemented in the linker.

The period between the namespace is correct. It is unrelated to the scope
operator in C++ being '::'.

Ronald Laeremans
Visual C++ team
 

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