[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Suppressing cpp compilation in MSDEV.

Posted on 2005-04-19
Medium Priority
Last Modified: 2013-11-20
The obj files which got created in the debug directory by another process(DOS mode) is to be used for linking to make an exe in MSDEV. In MSDEV how to suppress/ignore the compilation of cpp files?

Is there any flag available as part of project->settings to suppress the compilation of cpp files?

Question by:sathishkumar
  • 3
  • 2

Author Comment

ID: 13832633
The exact scenario is as follows:
1)In DOS mode a copy of .c files is made from soure machine to my local machine as .cpp (Curernt time stamp is marked for the file).
2)Immediately compiling the file and making obj in debug directory.(The cpp time stamp and obj time stamp is almost same).
Steps 1 and 2 are part of a batch process.
3)After all files are done(totalling nearly 100 files) with steps 1 and 2, I open the project in MSDEV and build to generate an exe.
4)MSDEV goes through the compilation process again eventhough there are no chanegs in the cpp files. But the obj timestamps is still the same as part of the step 2.

I understand that MSDEV is not able to resolve the time difference between cpp and obj of step 2. To test this I manually compiled(step 2 alone) some of the cpp files in DOS mode. In this case the obj files got created again with different time stamp.Then I opened the project in MSDEV and built it. It went directly to the linking process.

I cannot DEFINITELY change steps 1 to 3 in my work.That will remain fixed. I have the option of ONLY changing/altering the activities in step 4. I know that the obj files already exists. So my requirement is I don't want compilation to happen again in step 4 for the cpp files that are not changed.
LVL 14

Accepted Solution

wayside earned 600 total points
ID: 13832832
a couple of possibilities spring to mind:

- change the project configuration type to "makefile", build a makefile which just does a link, and build your project using nmake.

- add a pre-build event which "touch"-es all of the object files to change their timestamps. This would hopefully prevent the compilation and go to the link portion. (If you don't already know, touch is a unxi command which changes the modifcation date of a file to the current time. Implementations for Windows are easy to find). I think pre-build events may only be in VC++ .Net, but you didn't specify which version you are using.

Author Comment

ID: 13833521
The version what I am using is Visual Studio 6.0. I want the changes to be done in Visual Studio and not in DOS prompt through nmake.

For example
1) first time I run nmake and create an exe, it will get created.
2) next time when I open MSDEV and build the project, it is going to do the whole compilation process again which I had mentioned in step 4. This is what I want to avoid and our procedures dicdate that we have to use MSDEV for making an exe.

Hope this helps and makes it clear.

LVL 14

Assisted Solution

wayside earned 600 total points
ID: 13834859
If you are unwilling to have MSDEV run nmake for you (which does not involve a DOS prompt), the only other possibility I see is to do the following:

- Open  up project settings
- Expand the project, expand Source Files so you see each file
- Click on each file, under the "General" tab click the "Always use custom build step". Don't add any custom build steps

This has the effect of suppressing compilation. It also keeps these files from being linked by the linker. To fix this:

- Open up the project settings
- Click on the link tab
- Change the category to "Input"
- In the Object/library modules edit box, add all of the object files. My experiments show this can be wildcarded, e.g. add  "Debug\*.obj"  (minus the quotes) for example.

When you build, the exe should be created and no compiling is done.

Of course, this has the side effect that you will *never* be able to compile from within MSDEV.

Hope this helps.

Author Comment

ID: 14058783

Sorry for the late response. I tried all your approaches. All worked as you said but didn't help my purpose.

Finally I tried to convince the customer to do all the compilation in MSDEV only.
So as part of DOS, I am just copying the .c file as .cpp and doing the compilation only in MSDEV.


Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Integration Management Part 2
Suggested Courses

872 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