compile error when make a wchar_t conversion

G

George2

Hello everyone,


Here is the code, and if I change line from

static wchar_t* p[1] = {PREFIX((wchar_t*)_TEXT("FOO"))};

to

static wchar_t* p[1] = {PREFIX(_TEXT("FOO"))};

then code will be ok. Why?

Code:
#define UNICODE
#define _UNICODE

// include tchar.h

#define PREFIX(x)	(wchar_t*)_TEXT("GOO_") x

int main (int argc, char** argv)
{
	static wchar_t* p[1] = {PREFIX((wchar_t*)_TEXT("FOO"))};

	return 0;
}



main.c(10) : error C2064: term does not evaluate to a function taking
-22 arguments
main.c(10) : error C2143: syntax error : missing ')' before 'type'
main.c(10) : error C2059: syntax error : ')'


thanks in advance,
George
 
I

Ian Collins

George2 said:
Hello everyone,


Here is the code, and if I change line from

static wchar_t* p[1] = {PREFIX((wchar_t*)_TEXT("FOO"))};

to

static wchar_t* p[1] = {PREFIX(_TEXT("FOO"))};

then code will be ok. Why?
Learn how to invoke your compiler so it outputs the preprocessor output
and all will be revealed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top