I've been asked to add functionality to an existing old project but i cannot get it to build. It handles unicode strings but i get a lot of errors regarding the use of TCHAR.Specifically almost every error is TCHAR cannot be converted to or used as wchar_t. From what i saw on many different articles i tried using #define _UNICODE or #define UNICODE but none of them solved the problem.
Here is a piece of the code:
#include <windows.h>
#include <wininet.h>
#include <tchar.h>
#include <iostream>
#include <fstream>
#include <strsafe.h>
#include <string>
#include <list>
#include <cctype>
#include <winnt.h>
#include <atlconv.h>
#pragma comment(lib,"wininet.lib")
using namespace std;
TCHAR *tags[] = { _T("aa"), _T("bb"), _T("cc"),
NULL };
int _tmain(int argc, _TCHAR* argv[])
{
int i = 0;
for (i = 1; i<argc; i++) {
if (wcscmp(argv[i], _T("-h")) == 0) {
...
}
else if (wcscmp(argv[i], _T("-f")) == 0) {
...
}
...
}
In the above lines for example,when using wcscmp, i get
argument of type "_TCHAR *" is incompatible with parameter of type "const wchar_t *"
regarding the argv[i]
and
argument of type "const char *" is incompatible with parameter of type "const wchar_t *"
regarding the _T("-h").
Any suggestions would be really appreciated.