where to put #define

G

Guest

Hi,

If I put a #define somewhere in a file then the compiler complains with
'cannot define/undefine after first token in file'

So I plase #define in very begin of file, but then compiler say 'single line
comment or end of line expected'.

Now what ?
The second error does really not give me a hint on what is wrong :( What is ?

Or is #defoine in C# different ? eg I do this:
#define test 1
#define TEST
 
G

Guest

Unfortunately only your second define is valid in C# where
the #define defines a symbol that can be used with things
like #if and other precompiler directives.

Take a look at
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/csref/html/vclrfdefine.asp for a bit
more info.

Suffice to say, in C# you cannot #define a variable the
way you could in c or c++.
 
B

Brendan Grant

Unfortunately only your second define is valid in C# where
the #define defines a symbol that can be used with things
like #if and other precompiler directives.

Take a look at
http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/csref/html/vclrfdefine.asp for a bit
more info.

Suffice to say, in C# you cannot #define a variable the
way you could in c or c++.
 

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

Top