Suppressing cpp compilation in MSDEV.

Posted on 2005-04-19
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

    Author Comment

    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

    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

    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

    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


    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.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
    Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
    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.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now