help me with preprocessor #if #else #endif

hi,
whatever language I define result is same (ENGLISH)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#define LANGUAGE DEUTSCH 
#if LANGUAGE == ENGLISH
const wchar_t* Hello = L"Do you speak English?";
#elif LANGUAGE == DEUTSCH
const wchar_t* Hello = L"Sprechen Sie Deutsch?";
#elif LANGUAGE == HRVATSKI
const wchar_t* Hello = L"Govoris hrvatski?";
#else
const wchar_t* Hello = L"Parla italiano???";
#endif

int main() 
{
	wcout << Hello;  /*THIS ALWAYS DISPLAY'S THE SAME:
        Do you speak English?*/
	cout << endl << "finish...";
	cin.ignore();
	return 0;
}


USING MSVC++
thanks for help
You can only define a macro to be equal to a string of tokens, such as "+-/123" (the string contains four tokens). An undefined macro is equal to an empty string, thus line 1 is the same as saying LANGUAGE="".
Line 2 compares two empty strings, which are always equal.

What you can do is
1
2
3
4
#define ENGLISH 0
#define DEUTSCH 1
//...
#define LANGUAGE DEUTSCH 
thanks alot helios!, I get it now.
Topic archived. No new replies allowed.