Visual studio does not detect changes in header files - c++

I have recently installed Visual Studio 2013 Update 2 and I realized changing the header files does not trigger a build. I have to "touch" the corresponding ".cpp" file, or rebuild the whole project so the changes in ".h" file are considered. I did not have this problem before in Visual studio 2013 Ultimate. I tried disabling precompiled headers since I am not using it, but the problem still exists. I can clean and rebuild every time, but it is very time-consuming since the project is relatively large.

Related

Visual Studio 2017 Linux remote build - recompiling all cpp files on each build

I am using Visual Studio 2017 Community to develop application that is built on remote Linux machine (exactly Raspberry Pi 3). I have created a new project using Visual Studio's Raspberry Pi project template.
The problem is: even when I just change one line of code, the entire bunch of cpp files is rebuilding. My project consists 100+ source files and building time is reaching 10-20 minutes. It is really painful.
How can I change it, so building will only take place on changed file?
My guess is that you have a lot of includes in your header files. Try to move as many of them as possible to the cpp files.
The problem was MSBuild bug - see github.com/Microsoft/VSLinux/issues/29
Changing MSBuild to CMake solved all problems.

Visual studio thinks my project is up-to-date

So, I have a template function in my C++ header files, and when I make changes to it, Visual Studio 2013 still thinks that the project is up-to-date. So when i run my project, it runs like I didn't make any changes.
I can replicate this situation with any header file and template function, and only way to resolve it seems to be rebuilding. Is this just a bug in Visual Studio or do I have some settings wrong?

How to move a project from Visual Studio 2005 to Visual Studio 2012

I want to move my C++ project to Visual Studio 2012; I solved problems and can build and create the exe. But an error, msvcp80d.dll missing happens. I think that's a Visual Studio 2005 dll so I want to remove the dependency on that and get past the error. How can I do that?
Fastest way is to search your intermediate build folder for string msvcp80d.dll to see which file picks it up. If all, then look in your .vcxproj file and the .props files it imports.
If it's not found at all then you have an indirect tie, use depends.exe on your executable to see which other dll depends on this one. (You may do it right at start.)

Sharing a C++ solution between Visual Studio 2010 and 11

Me and my partner are both sharing a c++ solution via subversion.
He is using Visual Studio 11 and I am using Visual Studio 2010.
After the first time he commited and i updated, i get the following error:
Error 31 error MSB8008: Specified platform toolset (v110) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected.
also, in header files i get the following error on #include <stdio.h>:
error: cannot open source file "stdio.h"
I am guessing this is a compatibility issue. How can we resolve this?
In Visual Studio 11 there is a property option that allows you to specify the platform toolset.
Platform Toolset v110 is used by default if you create a new project starting from Visual Studio 11, but if can change it to v100 that is the one used by Visual Studio 2010.
.sln and .vcxproj files saved in Visual Studio 11 are not backward-compatible with VS2010. Even if they were compatible, eventually you'd step across a code which is compilable in VS11 but not in VS10.
The best (and probably the only) way is to agree on using exactly the same development environment.
A bit late in the discussion, but since you're using source control, you can remove the project and solution files from the repository and just share source code. Obviously, if you add new modules and such to a project, you'll have to manually add them in the other solution, but at least you wouldn't have to worry about this incompatibility. If you wanted to get down to it, the application can be built from the command line using just the compiler and linker switches, which tend to be far more compatible between revisions. Finally, you could use another build tool (besides MSBuild), that remains compatible across studio versions.
If you decide to remove the solution and project files, one thing to consider is saving a copy of the original YourApp.sln as YourApp.sln.2010. Then you'll have something to seed future solutions from, but updates to projects and solutions will all need done from VS 2010 and the file then copied to their .2010 version and maintained manually.
If SVN has support for patches, or if you're willing to run quilt externally (or if you switch to mercurial, you can use the MQ extensions), you can create the patch files to convert from 2010 to 2011 and remove the upgrade patche(s) before synch.
Drake's solution didn't work for me as the properties for all projects in the solution were already correctly set to v100. However, the fix that did work was to clean the builds and remove all other files that weren't source files or project files. I think it was probably removing the files projname.vcxproj.user that fixed it, as perhaps the toolchain preference was somehow overriden in the user preferences.

use msbuild to compile a vcxproj created by vs2010 on a computer without vs

I have created a large Visual C++ 10.0 project which builds nicely within the visual studio ide as well as within the "special" Visual Studio Command Prompt using msbuild with a vcxproj file.
However this project needs to be compiled by computers that do not have the vs ide, but only have the msbuild tool and the vc++ 10.0 runtime files.
The problem is that the vcxproj (created by the vs ide) file contains references to files such as Microsoft.Cpp.Default.props and Microsoft.Cpp.targets which clearly won't be available in a computer without visual studio.
Since all the compile and link command line options are available and fixed (no changes will be necessary), how is it possible to create a new vcxproj file to implement the compiling and linking of the project using these options?
I was finally able to make some tests on a "clean" computer. These are the results:
First, I installed .NET Framework 4.0 from http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17718. Along with it, MSBuild 4.0 was also installed automatically. When I tried to compile I got the following error:
error MSB4019: The imported project "H:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
which means that extra files are needed to compile the vcxproj and these files were missing. Note that simple project files written by hand (and not by the VS IDE) are expected to compile without problems since they contain no references to theses files (I did not test it for certain).
Next, I installed Windows SDK 7.1 from http://www.microsoft.com/download/en/details.aspx?id=8442. The error about missing files disappeared, but I got a new one. This new error (along with the way I overcomed it) is described in http://www.damirscorner.com/CommentView,guid,9121bd6b-876c-4051-8487-de1b95a7e919.aspx.
Doing the above successfully allowed me build my vcxproj file on a computer without vs2010.
I think that the files that you mention are not part of Visual Studio. They are part of MSbuild.