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

visual studio compiler option

1 view
Skip to first unread message

Zidan

unread,
Dec 22, 2009, 12:31:03 AM12/22/09
to
Is there anyway to skip some file in compilation time?
say my project having 300 cpp files, 100 view,100 controller,100
model, I need to compile only view in this time..
how I can set macro for this? or any other way?
any help really appreciable.

Joseph M. Newcomer

unread,
Dec 22, 2009, 1:13:24 AM12/22/09
to
Actually, if you've modified anything, it automatically recompiles. Therefore, everything
that needs to be recompiled IS recompiled.

Of course, you can screw this up royally by having one of those ghastly
#include "everything.h"
"umbrella" files that includes everything you might ever need in any compilation unit.

This is and always has been a lousy way to construct systems. Therefore, if you have done
it, you must change it or live with the consequences. To me, it has always been the
height of laziness of programmers to do this, and I consider it among Worst Practice
behavior. One of my students, many years ago, wrote a PhD disstertation proving beyond
any question that this is Worst Practice. She had the numbers to prove it.

So there is no reason to consider supporting what you are asking for. Either a file needs
to be recompiled, or it doesn't. If it doesn't, it won't get recompiled, and you don't
need to worry about it. If a dependency has changed, it MUST be recompiled, so you don't
want to NOT recompile it! So again, there's nothing to worry about. VS always does the
right thing (except if you hand-edit resource.h, which explicitly says to not consider it
a dependency file! Then you MUST do a "Rebuild All").

Please explain why you would ever need the capability you are asking for.
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Joseph M. Newcomer

unread,
Dec 22, 2009, 1:28:07 AM12/22/09
to
Or an alternative: make a view DLL, a controller DLL, a model DLL. Compile them as
separate projects. The only thing they share are interface files (files with no variables
and no private methods).
joe

On Mon, 21 Dec 2009 21:31:03 -0800 (PST), Zidan <zida...@gmail.com> wrote:

Zidan

unread,
Dec 22, 2009, 1:50:42 AM12/22/09
to
On Dec 22, 11:28 am, Joseph M. Newcomer <newco...@flounder.com> wrote:
> Or an alternative: make a view DLL, a controller DLL, a model DLL.  Compile them as
> separate projects.  The only thing they share are interface files (files with no variables
> and no private methods).
>                                 joe
>
> On Mon, 21 Dec 2009 21:31:03 -0800 (PST), Zidan <zidans...@gmail.com> wrote:
> >Is there anyway to skip some file in compilation time?
> >say my project having 300 cpp files, 100 view,100 controller,100
> >model, I need to compile only view in this time..
> >how I can set macro for this? or any other way?
> >any help really appreciable.
>
> Joseph M. Newcomer [MVP]
> email: newco...@flounder.com

Thanks for your reply, I cannot split again into dll(in fact group
are not model,view,controller simply I said one example) , as I
already split 10-20 separate dlls and linking it, I will try to do
first way..
thanks..

Tom Serface

unread,
Dec 22, 2009, 2:12:50 AM12/22/09
to
I found that the option to compile just the current file is very handy when
trying to work out kinks that involve changing a header that will cause
other files to compile. That way I can make sure the main one compiles
before having to go through the time of waiting for everything else. I'm
not sure why they don't put the single file on the build bar, but I always
add it.

Tom

"Zidan" <zida...@gmail.com> wrote in message
news:e8dc3410-e837-4be9...@u36g2000prn.googlegroups.com...

Stephen Myers

unread,
Dec 22, 2009, 10:01:22 AM12/22/09
to
Also, if your solution consists of several projects, there is Project
Only/Build.

Steve

David Ching

unread,
Dec 22, 2009, 11:05:52 AM12/22/09
to
"Zidan" <zida...@gmail.com> wrote in message
news:e8dc3410-e837-4be9...@u36g2000prn.googlegroups.com...

There isn't any way to skip files that need to be rebuilt in order to be
current. Using a precompiled header containing stable (unchanging) header
files drastically speeds compilation time; in a typical program, the files
names of the .cpp files being compiled scroll rapidly in the output window
as they are being compiled. It literally takes less than a second each to
compile.

If you are saying that some of these files do not need to be linked into the
final .exe or .dll, you can create a new project configuration and exclude
the unneeded files in that configuration. This is done using the Project
Properties | Configuration Properties | General | Excluded From Build of the
C++ files you want to exclude.

-- David

Tom Serface

unread,
Dec 22, 2009, 6:24:48 PM12/22/09
to
That is also a handy option, but if you edit a .h file that is going to
trigger a huge rebuild there is no way (other than file by file) to rebuild
that I can see.

Tom

"Stephen Myers" <""StephenMyers\"@discu...@microsoft.com"> wrote in
message news:OLiogexg...@TK2MSFTNGP02.phx.gbl...

Joseph M. Newcomer

unread,
Dec 22, 2009, 9:57:29 PM12/22/09
to
I've used Tom's technique for just the reasons he uses it, but once I have that header
file compiling AFAIK "correctly", then I just say "rebuild" and 20 files rebuild, and the
system reconverges to a fixed point.

The most common cause of this need is poor modularization, where every file includes every
header file (usually by the
#include "everything.h"
technique) so anyone who does this deserves what happens to them.
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com

Tom Serface

unread,
Dec 23, 2009, 12:15:53 AM12/23/09
to
Yeah, I try to stay away from the everything.h paradigm, but unfortunately,
MFC sort of espouses it even in the most basic of projects.

Tom


"Joseph M. Newcomer" <newc...@flounder.com> wrote in message
news:ll13j5116baca44c0...@4ax.com...

Joseph M. Newcomer

unread,
Dec 23, 2009, 2:47:35 PM12/23/09
to
Which I think is one of the more incredibly stupid technical misfeatures of the language.
The VERY FIRST thing I do with any new class I generate is to REMOVE the
#include "project.h"
line from the modules (for whatever "project" actually is). I sometimes replace it with
#include "resource.h"
but when I'm done, there is exactly ONE .cpp file that says to include that header file,
and it is the .cpp file of the corresponding name.

This is without a doubt a serious design flaw of MFC, but fortunately, it is easy to fix.
joe

0 new messages