Native to C++ CLI unresolved symboles
We have an excellent MFC/C++ project that handles the data to and from a legacy database. All classes are exported with AFX_EXT_CLASS (which is dllexport if i am not misunderstanding it). I am currently writing a wrapper so that we can use it in C# applications. This is my first real wrapper, so please bear with me.
This is what i have done:
If i understand this correctly, the .lib is the implementation, the .dll is the "wrapper" to be able to reference it as a .net-dll, and the header files are the class definition.
Now, i can define native objects in the C++/Cli project, but when i access functions therein and try to build it, it throws external reference not found errors on the objects that i am trying to define.
This is understandable because it can not know that the header files point to the implementation in the .lib. The header files are used as is.
What am i doing wrong? Am i supposed to point at the header files? Should it not use the .dll to find the class definitions that are implemented in the .lib file? Should i create a .def file to point at the library?
There seem to be a missing piece to this puzzle and i am expecting to experience an aha-moment any moment now...
Please note that this is not a general linkage question, it is specifically about the practical use of AFX_EXT_CLASS exported classes, MFC and C++/CLI.
Cheers and thank you
You don't need your step 4. Also, try to don't use Precompiled headers like stdafx.h
in your project, Go to C/C++ -> Precompiled Headers -> Not using precompiled headers and Check Linker -> Additional Dependecies -> Inherit from parent or project defaults . Finally, check the error message link if it's point to windows library use missing try to include .lib library using #pragma comment (lib, "yourlib.lib")
上一篇: Android和Facebook共享意图
下一篇: 原生C ++ CLI未解析符号