473,398 Members | 2,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

compile error when make a wchar_t conversion

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?

Expand|Select|Wrap|Line Numbers
  1. #define UNICODE
  2. #define _UNICODE
  3.  
  4. // include tchar.h
  5.  
  6. #define PREFIX(x)    (wchar_t*)_TEXT("GOO_") x
  7.  
  8. int main (int argc, char** argv)
  9. {
  10. static wchar_t* p[1] = {PREFIX((wchar_t*)_TEXT("FOO"))};
  11.  
  12. return 0;
  13. }
  14.  
  15.  
  16.  
  17. main.c(10) : error C2064: term does not evaluate to a function taking
  18. -22 arguments
  19. main.c(10) : error C2143: syntax error : missing ')' before 'type'
  20. main.c(10) : error C2059: syntax error : ')'
  21.  

thanks in advance,
George
Nov 26 '07 #1
1 1862
George2 wrote:
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.

--
Ian Collins.
Nov 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bren | last post by:
Hi all, I wonder if anyone knows of a string class out there that can do on demand conversion from wchar_t to char? We are writing an app that will need to be localized and cross platform. ...
3
by: Rob F | last post by:
I am trying to compile a string class which was working before but subsequent attempts to make it more 'object orientated' (privatizing the member variables and implenting query functions) it...
2
by: Abhijit Bhadra | last post by:
Hi , I was trying to build my project in VC with latest Service Packs but got this error . C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlconv.h(125) : error C2440: 'return' :...
9
by: Vinu | last post by:
Hai when i compile the cpp file(cmdargs.cpp) i attached the output below the program int main(int argc, wchar_t* argv) { std::wcout<<L"Name of the Program is "<<*argv<<std::endl;...
7
by: Karthik | last post by:
Hello I am trying to convert the following??? The Code std::string* ChkName;
4
by: David Killian Woods | last post by:
I just installed VC++.NET and haven't had much luck. It just won't compile anything that isn't stored on a local hard drive. Local projects are fine (well, other than my stupid mistakes) and...
1
by: Marcin Kalicinski | last post by:
wchar_t c1 = wchar_t('A'); wchar_t c2 = L'A'; Is c1 equal to c2? If they are not equal, how can I create wchar_t character representing the same character as some char value? cheers,...
1
by: William | last post by:
I am using mingw and msys, there is a complier error: c:/cpp/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bits/basic_ios.h: In instantiation of `std::basic_ios<wchar_t,...
6
by: ssetz | last post by:
Hello, For work, I need to write a password filter. The problem is that my C+ + experience is only some practice in school, 10 years ago. I now develop in C# which is completely different to me....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.