views:

226

answers:

1

I have the C++ source code in a Visual Studio project from another developer that compiles into a static lib. I need to change it so that it builds a dll from that code so that I can call it from C#. I went into the project properties in Visual Studio and changed the configuration type to a DLL. However, it now gives lots of linker errors like:

error LNK2001: unresolved external symbol __CAP_Enter_Function  XXXFilter.obj XXXFramework

What else do I need to do in Visual Studio and in the code to produce a dll from the code instead of a lib? The library is huge so writing a wrapper is not an option. I have the code so I should be able to make it build a dll.

I am not a very experienced C++ dev but I am in C# and visual studio. The C++ command line is:

/Od /Oi /D "_DEBUG" /D "_XBOX" /D "XBOX" /D "_XBOX_CRT_DEPRECATE_INSECURE" /D "_MBCS" /FD /MTd /Yu"stdafx.h" /Fp"Debug/AtgFramework.pch" /Fo"Debug\" /Fd"Debug\vc80.pdb" /W4 /nologo /c /Zi /TP

Thanks

+1  A: 

Somewhere in the C++ project someone has used the /callcap Visual C++ argument. I don't think there is a C++ setting for it so it's most likely in the "Additional options" / "Command Line" section. Remove the option and it should link ok.

Shane Powell
Thanks. That solves a lot of the linking errors but not all of them. There are many more unresolved external symbol errors. I'd post them but there are 1700 of them. The C++ command line is:/Od /Oi /D "_DEBUG" /D "_XBOX" /D "XBOX" /D "_XBOX_CRT_DEPRECATE_INSECURE" /D "_MBCS" /FD /MTd /Yu"stdafx.h" /Fp"Debug/AtgFramework.pch" /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W4 /nologo /c /Zi /TP
Clark Battle
I can't comment on the other unresolved external's. Most likely they are required libraries used by the source and the compiler switches will not help.
Shane Powell