Click here to Skip to main content
15,915,869 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Smarter ways to define MACRO to strings? Pin
CPallini21-Nov-07 21:26
mveCPallini21-Nov-07 21:26 
AnswerRe: Smarter ways to define MACRO to strings? Pin
George_George21-Nov-07 21:35
George_George21-Nov-07 21:35 
GeneralRe: Smarter ways to define MACRO to strings? Pin
CPallini21-Nov-07 21:54
mveCPallini21-Nov-07 21:54 
GeneralRe: Smarter ways to define MACRO to strings? Pin
George_George21-Nov-07 23:57
George_George21-Nov-07 23:57 
GeneralRe: Smarter ways to define MACRO to strings? Pin
CPallini22-Nov-07 0:18
mveCPallini22-Nov-07 0:18 
GeneralRe: Smarter ways to define MACRO to strings? Pin
George_George22-Nov-07 1:24
George_George22-Nov-07 1:24 
GeneralRe: Smarter ways to define MACRO to strings? Pin
CPallini22-Nov-07 2:19
mveCPallini22-Nov-07 2:19 
GeneralRe: Smarter ways to define MACRO to strings? Pin
George_George22-Nov-07 18:28
George_George22-Nov-07 18:28 
Hi CPallini,


Could you try the code please? I am using Visual Studio 2005. The code can not compile. If there is any programming error in the code, please feel free to let me know. Smile | :)

<br />
#define PREFIX(x) _T("FOO##x");<br />
<br />
<br />
int main()<br />
{<br />
<br />
	const TCHAR* SecondArray [2] = {PREFIX(_T("FILE1")), PREFIX(_T("FILE2"))};<br />
<br />
	TCHAR* p = NULL;<br />
	p = SecondArray [0];<br />
	p = SecondArray [1];<br />
<br />
<br />
	return 0;<br />
}<br />


main.cpp(9) : error C2143: syntax error : missing '}' before ';'
main.cpp(9) : error C2143: syntax error : missing ';' before ','
main.cpp(12) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
main.cpp(12) : error C2040: 'p' : 'int' differs in levels of indirection from 'TCHAR *'
main.cpp(12) : error C2065: 'SecondArray' : undeclared identifier
main.cpp(13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
main.cpp(13) : error C2040: 'p' : 'int' differs in levels of indirection from 'TCHAR *'
main.cpp(16) : error C2059: syntax error : 'return'
main.cpp(17) : error C2059: syntax error : '}'
main.cpp(17) : error C2143: syntax error : missing ';' before '}'
main.cpp(17) : error C2059: syntax error : '}'


regards,
George
GeneralYou're right Pin
CPallini22-Nov-07 21:46
mveCPallini22-Nov-07 21:46 
GeneralRe: You're right Pin
jhwurmbach22-Nov-07 21:58
jhwurmbach22-Nov-07 21:58 
GeneralRe: You're right Pin
George_George22-Nov-07 22:07
George_George22-Nov-07 22:07 
GeneralRe: You're right Pin
CPallini22-Nov-07 22:11
mveCPallini22-Nov-07 22:11 
GeneralRe: You're right Pin
George_George22-Nov-07 22:04
George_George22-Nov-07 22:04 
AnswerRe: Smarter ways to define MACRO to strings? Pin
jhwurmbach21-Nov-07 21:09
jhwurmbach21-Nov-07 21:09 
GeneralRe: Smarter ways to define MACRO to strings? Pin
George_George21-Nov-07 21:19
George_George21-Nov-07 21:19 
GeneralRe: Smarter ways to define MACRO to strings? Pin
jhwurmbach21-Nov-07 21:32
jhwurmbach21-Nov-07 21:32 
GeneralRe: Smarter ways to define MACRO to strings? Pin
George_George21-Nov-07 21:50
George_George21-Nov-07 21:50 
GeneralRe: Smarter ways to define MACRO to strings? Pin
jhwurmbach21-Nov-07 21:55
jhwurmbach21-Nov-07 21:55 
GeneralRe: Smarter ways to define MACRO to strings? Pin
George_George21-Nov-07 23:56
George_George21-Nov-07 23:56 
GeneralRe: Smarter ways to define MACRO to strings? Pin
jhwurmbach22-Nov-07 0:41
jhwurmbach22-Nov-07 0:41 
GeneralRe: Smarter ways to define MACRO to strings? Pin
George_George22-Nov-07 1:27
George_George22-Nov-07 1:27 
AnswerRe: Smarter ways to define MACRO to strings? Pin
Jonathan [Darka]21-Nov-07 21:41
professionalJonathan [Darka]21-Nov-07 21:41 
GeneralRe: Smarter ways to define MACRO to strings? Pin
CPallini21-Nov-07 21:51
mveCPallini21-Nov-07 21:51 
GeneralRe: Smarter ways to define MACRO to strings? Pin
George_George21-Nov-07 21:52
George_George21-Nov-07 21:52 
AnswerRe: Smarter ways to define MACRO to strings? Pin
toxcct21-Nov-07 21:58
toxcct21-Nov-07 21:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.