Connecting Tech Pros Worldwide Help | Site Map

Using MFC DLL in managed code

Denis Sohet
Guest
 
Posts: n/a
#1: Nov 17 '05
Hi,

I have to use a MFC C++ DLL (unmanaged of course) in a C++ .Net project.
I have problems to do that. I've created a C++ .Net project and includes the
MFC DLL.
My problems comes as soon as I call a method (ctor, dtor or method) from the
MFC DLL.
I've got this kind of error :

error LNK2001: unresolved external symbol "public: __thiscall
toto::toto(void)" (??0toto@@$$FQAE@XZ)
fatal error LNK1120: 2 unresolved externals


toto is the unmanaged class from the MFC DLL.
I call it in the C++ .Net class like this :

toto *p;
p = new toto();


(the first line compiles but not the second)


My MFC DLL is OK (compiles fine), and in my managed project I've just do
this to access MFC DLL :

Remove nochkclr.obj from Linker|Input|Additional Dependencies
Add msvcrt.lib to Linker|Input|Additional Dependencies
Add my library file to Linker|Input|Additional Dependencies
Add /noentry to Linker|CommandLine|Additional Options
Add __DllMainCRTStartup@12 to Linker|Input|Force Symbol References


Thanks
Closed Thread