| dan.sweeney@dynavoxsys.com 2005-08-09, 5:04 pm |
| I've got a perl script that spits out a header that some of my .cpp
files need. The perl script takes VisResources.txt as its input and
produces VisResources.h as its output. I added VisResources.txt to my
VS project and defined the custom build step which uses the perl. No
problem there. The problem is that the .cpp files which depend on
VisResources.h are not automatically built after the new version of
this file is created. So I've got to Build twice everytime I modify
VisResources.txt. Very annoying.
So here's the question. How can I force the .cpp files to be rebuilt
whenever the new header is created?
The MSDN site gives the instructions shown below. They don't work.
Once I check the "Always use custom build step" option on one of the
..cpp files, that file is no longer built at all. And specifying the c
compiler command line there makes no sense, because then I would lose
the Project Settings.
Thanks.
Dan
----------------------------------------
Instructions from MSDN
----------------------------------------
MSDN Home > MSDN Library > Development Tools and Languages > Visual
Studio 6.0 > Visual C and C++ 6.0 > How Do I... Topics: Working With
Projects and Workspaces > Adjusting the Build Settings
Specifying Input Dependencies
Home Page (Projects) | Overviews | How Do I... Topics | NMAKE
Reference
Specifying input dependencies on a per-file basis is a way to ensure
that your build steps run in the order you need them to. For example,
you may have a custom build step that creates an output file,
MyOutput.h. Another file in the project, MyInput.cpp, may have a build
rule that depends on MyOutput.h. You can specify MyOutput.h as an input
dependency to MyInput.cpp, and the build system will first ensure that
MyOutput.h exists and is up-to-date before running the custom build
steps for MyInput.cpp.
You can specify input dependencies to a file even if the build process
doesn't recognize the extension of either the input file or the
dependent file.
To specify input dependencies
On the Project menu, click Settings.
Specify the project configuration and select the file for which you
want to specify input dependencies.
Select the Custom Build tab.
Note If the file type is one that is already handled by the build
system (such as .cpp, rc., .idl) you need to check the Always use
custom build step option on the General tab in order for the Custom
Build tab to appear.
Click the Dependencies button.
Type all of the input files into the User-defined dependencies dialog
box.
|