Ignoring a file in a solution

Hiya

I have a cpp file which is in a solution in Visual Studio 2008 which I use as a temporary area for me to write development code. As such the code isn't always in a compilable state.

Because of this, when I compile, I get loads of errors from this file.

Is there a way for me to tell the compiler to ignore the code in the file? The way I'm doing this at the moment is to just comment all the code but I don't really want to do this.

Is there a declaration I can use to tell the compiler to ignore all the code in the file?

John
IssacJonesAsked:
Who is Participating?
 
alb66Commented:
On solution explorer right click on the file and choose properties.
Select "Exclude from compilation" : yes
0
 
ZoppoCommented:
Hi IssacJones,

you can either exclude the file from build (right click at the file in the solution tree, Properties from context menu, set 'Excllude from build' to 'yes'.

Or you can simply encapsulate the code you don't want to be compiled with a #if/endif like this:

> #if 0

> You can write here what you want ...
>
> #endif

Hope that helps,

ZOPPO
0
 
ZoppoCommented:
Sorry, alb66 ...
0
 
StefanKittelCommented:
Hello,

you can put a /* to the top and a */ to the bottom

Stefan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.