I have two projects:
Project1: An ATL COM based project whose output is a .lib file (a static library)
Project2: An MFC based GUI Application which links to the static library so that the functions in that can be used.\
Whereever required, the .h file of the corresponding file is included in project1.
Now the calls from Project2 to functions in Project1 are happenning fine until I have to use a function which takes CString as a parameter.
Whenever there is a call which has CString as parameter (which is implemented in Project1's code), a link error pops up which states that it is unable to link to the function.
When googled I found out that the implementation of CString in ATL and MFC frameworks is different. So the obvious solultion is to pass CString which is implemented for ATL from Project2 because Project1 is ATL based.
So, I am passing CAtlString from Project2 when I am calling the function. But it is giving me back the same link error and in the error it is passing MFC version of the CString eventhough I am passing a CAtlString.
Can anyone give me the solution please.
More specific details of the project, I am providing below:
ATL project is a COM based ATL project which has many hundered classes and functions. The output of it has been set to a .lib file. If any solution links to that .lib file, it can access all the methods exposed in it.
MFC Project is an SD (Single Document) one. To be more specific, if at all it makes a difference to you, MFC Application is for CPPUNIT (used for unit testing).
IDE - Microsoft Visual Studio 2005 Version 8.0.50727.762 I don't know the versions of ATL and MFC (I don't know how to check it, actually. If you could be of help here as well)
The link error
error LNK2019: unresolved external symbol "public: __thiscall NamespaceInProject1::CClassInProject1::CClassInProject1(class ATL::CStringT > >)" (??0CClassInProject1@NamespaceInProject1@@QAE@V?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z) referenced in function "public: void __thiscall CClassInCPPUNITTester::TesterFunction_PTC01(void)" (?TesterFunction_PTC01@CTestsXPathParser@@QAEXXZ) ClassInCPPUNITTester.obj
NamespaceInProject1
- Namespace underwhich the class is declared in the Project1CClassInProject1
- A Class in Project1 whose functions I am testing
CClassInCPPUNITTester
- The class in Project2 from which I am calling the function of the classCClassInProject1
TesterFunction_PTC01(void)
- The function in function of Project2 is called.I am able to call all the methods that do not take CString as argument perfectly. I have tested them and they work just fine. Problem only occurs when I have CString as argument.
Please help
I have tried many solutions which are presented in Stackoverflow previously. None of them helped.
Note: i am passing the CString by value and not by reference when calling. Its a call by value.