473,396 Members | 1,724 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,396 software developers and data experts.

#if preprocessor not working

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
Apr 19 '06 #1
5 2459
Hi,

AFAIK a preprocessor flag is bounded by a project, there is nothing like a
solution wide preprocessing directive :(
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"tb2000" <tb****@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
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

Apr 19 '06 #2
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.

???

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

AFAIK a preprocessor flag is bounded by a project, there is nothing like a
solution wide preprocessing directive :(
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"tb2000" <tb****@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
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


Apr 19 '06 #3

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

Weird...
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

AFAIK a preprocessor flag is bounded by a project, there is nothing like a
solution wide preprocessing directive :(
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"tb2000" <tb****@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
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


Apr 19 '06 #4
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 Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"tb2000" <tb****@discussions.microsoft.com> wrote in message
news:C9**********************************@microsof t.com...

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

Weird...
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

AFAIK a preprocessor flag is bounded by a project, there is nothing like
a
solution wide preprocessing directive :(
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"tb2000" <tb****@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
> 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
>
>


Apr 19 '06 #5

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

"Ignacio Machin ( .NET/ C# MVP )" wrote:
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 Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"tb2000" <tb****@discussions.microsoft.com> wrote in message
news:C9**********************************@microsof t.com...

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

Weird...
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

AFAIK a preprocessor flag is bounded by a project, there is nothing like
a
solution wide preprocessing directive :(
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"tb2000" <tb****@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
> 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
>
>


Apr 19 '06 #6

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

Similar topics

205
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
5
by: Boris Kuznetsov | last post by:
This occurs in an empty project when I add the following string: #using <mscorlib.dll> Can anyone tell me why would #using ... not be working???? MSDN says nothing about this error. Please...
24
by: Nudge | last post by:
I have an array, and an unrolled loop which looks like this: do_something(A); do_something(A); .... do_something(A); I thought: why should I type so much? I should write a macro. So I was...
13
by: Chris Croughton | last post by:
Is the following code standard-compliant, and if so what should it do? And where in the standard defines the behaviour? #include <stdio.h> #define DEF defined XXX int main(void) { int...
9
by: Walter Roberson | last post by:
I have run into a peculiarity with SGI's C compiler (7.3.1.2m). I have been reading carefully over the ANSI X3.159-1989 specification, but I cannot seem to find a justification for the behaviour....
32
by: spibou | last post by:
Is the output of the C preprocessor deterministic ? What I mean by that is , given 2 compilers which conform to the same standard, will their preprocessors produce identical output given as input...
31
by: Sam of California | last post by:
Is it accurate to say that "the preprocessor is just a pass in the parsing of the source file"? I responded to that comment by saying that the preprocessor is not just a pass. It processes...
36
by: anon.asdf | last post by:
Hello! Can the proprocessor make conditional decisions. Here's an example of the functionality (not standard C!) #define PUT_BYTE(const_index, val) \ #preprocessor_if (const_index ==...
5
by: _dwin | last post by:
Hi, Does anyone know how to implement your own preprocessor directive? For instance, I would like to have a directive which goes like: #<directive_name<parameters, ...> ie. #compress...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.