?
Solved

Ignoring a file in a solution

Posted on 2009-04-28
4
Medium Priority
?
263 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:IssacJones
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
alb66 earned 1000 total points
ID: 24251932
On solution explorer right click on the file and choose properties.
Select "Exclude from compilation" : yes
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 24251969
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
 
LVL 31

Expert Comment

by:Zoppo
ID: 24251974
Sorry, alb66 ...
0
 
LVL 4

Expert Comment

by:StefanKittel
ID: 24255409
Hello,

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

Stefan
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question