jeudi 26 février 2015

C2338 compile error for a Microsoft Visual Studio unit test

I am receiving the following error when I attempt to compile a unit test in Visual Studio 2013:



Error 1 error C2338: Test writer must define specialization of ToString<Q* q> for your class class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > __cdecl Microsoft::VisualStudio::CppUnitTestFramework::ToString<struct HINSTANCE__>(struct HINSTANCE__ *).



You can replicate the error by having a test method such as below:



const std::wstring moduleName = L"kernel32.dll";
const HMODULE expected = GetModuleHandle(moduleName.c_str());
Microsoft::VisualStudio::CppUnitTestFramework::Assert::AreEqual(expected, expected);


Does anyone know how I need to go about writing such a specialization of ToString?


Aucun commentaire:

Enregistrer un commentaire