Your VC++ project is setup as a UNICODE so all the references to TCHAR
are resolved into a wide character type w_char
. However your vtk's SetFileName()
function doesn't support UNICODE thus the compilation error.
To fix this you should either change the properties of your project to use ASCII or MBCS (depending on your needs) or do the manual UNICODE->MBCS (or into ASCII) conversion.
Below is an example on how to convert UNICODE into MBCS using system codepage:
const size_t fnameLen = 1024;
char * fname[fnameLen];
int converted = WideCharToMultibyte(
CP_ACP
, WC_COMPOSITECHECK | WC_ERR_INVALID_CHARS
, lpszPathName
, -1 // null-terminated string
, fname
, fnameLen
, NULL // or whatever you'd like it to be
, NULL);
m_pvtkBMPReader->SetFileName(fname); // <-- this should work now as it is char*
Please note that I have just written down that code without compiling, so expect that you may need some tweaking before this builds and runs properly.
ATL and MFC provide a bunch of convenient macroses to simplify the string conversions.