#if preprocessor not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here's my scenario: VS2005, .NET and .NETCF C# projects mices in a single
solution file, referencing the same source code base (the NETCF projects use
reflinks to the NET sources)

Now I am trying the following
#if !NETCF
{some code which is only compileable under .NET but now is excluded}
#endif

NETCF is defined in compiler settings
the output window shows correctly a /define:TRACE;DEBUG;PocketPC;NETCF

however the #if !NETCF (I tried an #if FULLFRAMEWORK too) is ignored by the
compiler....

What am I missing?
Thanks ahead for any help!
tb
 
Hi,

AFAIK a preprocessor flag is bounded by a project, there is nothing like a
solution wide preprocessing directive :(
 
Thanks, I know and I am not trying solution wide.

I have different in the same solution projects and they have different
preprocessor defines as part of their project props.

One of the projects in which the source files are actually referenced as
links, it seems the compiler defines, even though they appear on the command
line, are ignored when compiling the source.

???
 
I just deleted the intellisync database of the project and now the compiler
is working again.

Weird...
 
Hi,


What you mean with the compiler?
Ar eyou refering to anychange to the gray coloring of the part that is not
being used at a time?
If that is so it's not the compiler it's the IDE and it has happened to me
before, even with a regular (non-linked) file
 
Ignacio, thanks, I think I figured the 'grey' issue: I had the file opened
as a member in a different project, so those files applied. Now that I have
it open
in the desired project, all is correct.

I sometimes have effects with the intellisync database corrupting, I usually
can see it if the size goes beyond 7-8MB. I then delete it.

Still only after deleting it (and I know it should not be affecting the
compiler, only the IDE) I got the compile run to correctly reflect on the #if
... #endif clauses. Maybe it still was the IDE but I have no explanation.

Anyways and again thanks for your support!

Theo
 

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

Back
Top