CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Posts
    98

    Visual Studio recompiles every time

    Hello,

    I am running Visual Studio 10 project, and I have some code that compiles fine. I have just recently included a third-party library with a header file. Now, every time I run my project, Visual Studio recompiles my source code, even when I do not make a single change to the code. It gives me this message in the output window: "Skipping... (no relevant changes detected)", but then, for whatever reason, takes ages to compile the code. (The header file that comes with the library is not that big anyway, so on another point, I am wondering why it is taking so long to compile.) Is there something that could be written into the header file or library that tells Visual Studio to recompile everything with each run? Any thoughts on what is going on here?

    Thank you,

    Ed.

  2. #2
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: Visual Studio recompiles every time

    Perhaps one of your source files (most likely a header file) has got a date that's in the future. So no matter when you do a build, that file will always appear to be newer than the object files that got built from it.
    "A problem well stated is a problem half solved.” - Charles F. Kettering

  3. #3
    Join Date
    Aug 2006
    Posts
    98

    Re: Visual Studio recompiles every time

    Hello,

    Thanks for your help. I'm not sure what you mean by one of my source files having "a date that's in the future"? I am not making any changes to any of the code. I just click on the green arrow to start debugging, and then I get the following messages:

    1>------ Build started: Project: My_Project, Configuration: Debug x64 ------
    1> Skipping... (no relevant changes detected)
    1> main.cpp
    1> Scene_Recognition.vcxproj -> C:\Data\My_Project\x64\Debug\My_Project.exe

    Each of these lines is displayed for about 1 minute each, before displaying the next one. I am not making a single change to the code though -t should just run from the previous .exe that it built! The main.cpp file contains the int main() function, but as with all source and header files, I have not been making any changes to it between each time I run the debugger.

    I have realised that it is nothing to do with the third-party library I am using - I have now stopped using this library, but the problem still persists. I have also tried things like creating the project from scratch again, rebooting my computer etc. I have about 30 source files and 30 header files, but a project of this size shouldn't be causing this issue should it? I didn't have this problem a few days ago, and I can't seem to think of what I might have done to cause the problem.

    Any help would be appreciated

    Ed.
    Last edited by ejohns85; February 25th, 2013 at 02:51 PM.

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Visual Studio recompiles every time

    Quote Originally Posted by ejohns85 View Post
    Hello,

    Thanks for your help. I'm not sure what you mean by one of my source files having "a date that's in the future"?
    The build system uses file dates as a means to figure out what is old and needs to be rebuilt.

    If one of your source files has a file date that is in the future, then of course the system will keep rebuilding. For example, if you have a CPP that has the year "2015" as the file date, then when you build the OBJ from the CPP file, that OBJ file will be dated with today's date, which is the year 2013. When you build again, the system again sees the 2015 CPP, and thinks that the target OBJ is old and needs to be rebuilt. This will never end unless you do this for two years straight, or you change the CPP date to today's date.

    Did you do the obvious and check the date on all of your source files?

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; February 25th, 2013 at 04:20 PM.

  5. #5
    John E is offline Elite Member Power Poster
    Join Date
    Apr 2001
    Location
    Manchester, England
    Posts
    4,835

    Re: Visual Studio recompiles every time

    ejohns85 - I'm not sure if it'll be relevant in your case but I just stumbled upon this MSDN article which might help you.

    Apparently, if your project is on a FAT32 drive there can be a 2 second delay between a request to update a file's timestamp and the actual filestamp getting updated. I had a problem where my builds weren't getting a manifest embedded properly. Visual Studio's FAT32 workaround setting did solve it. Maybe it'll help you too?
    "A problem well stated is a problem half solved.” - Charles F. Kettering

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured