Communication error: unresolved << operator for std :: basic_ostream with CStringT

I just reorganized some libraries of my Visual C ++ project (7.1) and got problems with the linker, which I cannot solve.

The project links MFC as well as standard Windows libraries, all MBCS

Somewhere there is something like:

std :: stringstream sstr; sstr <m_MyCStringVar <std :: cps;

(this line, like some others, needs <<for basic_stream and CString)

Everything was fine until I merged 2 other libraries into 1 library (just moving code / files from a to b without changing much)

Suddenly, all my exes generate a linker error:

BasicFunctionsD.lib(CAccess.obj): LNK2019: "class std:: basic_ostream > __cdecl < ( std:: basic_ostream > &, ATL:: CStringT โ†’ const &;)" (?? 6 @YAAAV? $Basic_ostream @DU? $Char_traits @D @std @@@std @@AAV01 @ABV? $CStringT @DV? $StrTraitMFC_DLL @DV? $ChTraitsCRT @D @ATL @@@@@ATL @@@Z) "protected: void __thiscall CAccessor:: CreateCategory (int, char const *, char const *)" (? CreateCategory @CAccessor @@IAEXHPBD0 @Z)

( , , )

, < ostream CString .

lib, MFC basic_ostream, ?

, .

+3
2

...

: std:: ostream CString... , ...:(

D'!

namesspace StupidcleanupIshouldNotHavedone { std:: ostream operator < (std:: ostream s, const CString str) {   s < (LPCTSTR) ;   return s; } }

+3

, , , IIRC . ...... #include <string>. , . , , , , .

+1

Source: https://habr.com/ru/post/1729876/


All Articles