Search code examples
c++mfccstringunicode-string

MFC CString Linker error between two projects


I have 2 projects in c++ (MFC) One is a library project which im using in the second one (an executable one).

They work together great, until I call a function from the regular project that takes a CString as argument. I get a linker error like this

error LNK2019: unresolved external symbol "public: void __thiscall 
CTextDisplay::SetText1(class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,
class ATL::ChTraitsCRT<wchar_t> > >)" (?SetText1@CTextDisplay@@QAEXV?$CStringT@_WV?
$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@@Z) referenced in function 
"public: void __thiscall CManualPane::SetBeadCountFor(int,double)" 
(?SetBeadCountFor@CManualPane@@QAEXHN@Z)    C:\source\IQ-Project\IQ\ManualPane.obj  IQ

The executable project has its character set to UNICODE but the Library has it set to Multy-Byte chatacter set. I really can't change them without getting ridiculous amounts of errors.

Any suggestions?

Edit: The reason we have different settings in these two projects is because the Executable project is basically an external project that my group didn't build or create. We just had to bring it in and use it. The library project is something we've all been working on for a couple years.


Solution

  • In the end it proved to be a better idea to avoid having unicode and multybyte projects in the same solution so I moved it all to unicode and went from there