Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Preprocessor inactive

236 views
Skip to first unread message

Roby Eisenbraun Martins

unread,
Jul 1, 2005, 7:51:01 AM7/1/05
to
Hello,

I'm having a very strange error using Visual Studio NET C++.
I'm creating an application using several .h files and I'm colling them
using #include. To avoid call the same file twice in all the code I'm using
the following technique, because I want to work only with basic C ANSI
commands.

#ifndef METHOD_H
#define METHOD_H
#endif /* METHOD_H */

But I don't know why Visual studio "DISABLED" the code and add this
commentary "Inactive Preprocessor Block".
After that, all the code in this section is not been used.
What is this? How can I make this code be not "disabled" any more?

Thank you,
Roby Eisenbraun Martins

Victor Bazarov

unread,
Jul 1, 2005, 9:16:24 AM7/1/05
to
Roby Eisenbraun Martins wrote:
> I'm having a very strange error using Visual Studio NET C++.
> I'm creating an application using several .h files and I'm colling them
> using #include. To avoid call the same file twice in all the code I'm using
> the following technique, because I want to work only with basic C ANSI
> commands.
>
> #ifndef METHOD_H
> #define METHOD_H

Here you are supposed to place all the header contents. Did you?

> #endif /* METHOD_H */
>
> But I don't know why Visual studio "DISABLED" the code and add this
> commentary "Inactive Preprocessor Block".

Because it probably does nothing. Where is the rest of the header?

> After that, all the code in this section is not been used.

Not been used? What do you mean?

> What is this? How can I make this code be not "disabled" any more?

Make sure it affects something. As posted the code affects basically
nothing.

Try to make a clean rebuild. Maybe some precompiled headers are stomping
out all your efforts...

V

Roby Eisenbraun Martins

unread,
Jul 1, 2005, 11:23:02 AM7/1/05
to
Hello Victor,

Thank you for your help.
Yes, I'm using the methods headers between #define METHOD_H and #endif.
The strange part is the code been disabled!
I'm working just like this:

// Method.h File

#ifndef METHOD_H
#define METHOD_H

// Include Files
// Macro Declarations
// Structs, Enums Declarations
// Method Headers

#endif /* METHOD_H */

// Same Include Files
// Same Macro Declarations
// Same Structs, Enums Declarations
// Method body

// End of File

Tim Roberts

unread,
Jul 2, 2005, 6:33:55 PM7/2/05
to
"Roby Eisenbraun Martins" <RobyEisenb...@discussions.microsoft.com>
wrote:

> Hello Victor,
>
> Thank you for your help.
> Yes, I'm using the methods headers between #define METHOD_H and #endif.
> The strange part is the code been disabled!
> I'm working just like this:

My guess is that method.h has been included earlier in the unit, probably
as a side effect of including some OTHER include file. Remember, that's
the whole purpose of the #ifndef\#define dance you have.
--
- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc

0 new messages