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

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.

Related

Using Visual Studio 2017/2019 to run VS 2008 C++ project

I wonder if anybody has experience converting VS 2008 C++ solution to VS 2017/19 without switching to newer SDK and toolset. The solution is quite old, very large, uses 3-rd party libraries, so full conversion is out of the question. The goal is only to switch to better user interface.
Theoretically it is probably possible, although I successfully converted only very basic C++ MFC project.
Project settings in VS 2017 show only latest toolset. To make other toolsets to appear, I had to install VS 2010, and also add SDK 8.1 from VS installer (without VS 2010, this option is not available). Then select toolset v.90 and SDK 8.1 for each project in solution.
At this point, simple converted project works fine. A large legacy solution has a lots of issues. I resolved generic ones, but it looks like uphill battle. For example, C++ directories are physically different and some of the files are missing. It may be possible to eventually assign original VS 2008 directories to each project and/or copy missing files, but I have the impression of doing something illegal.
The question is, is it a valid procedure and still possible after latest updates.
Thanks==

Visual Studio 2013, error MSB8020: The build tools for Visual Studio 2010 cannot be found

At the start I'd like to note that I've spent some time researching this issue and suggested solutions for similar questions like this one didn't help me.
Problem background
I need to migrate a Firebreath plugin project (which I haven't worked on previously) from PC_1 to PC_2.
As far as I'm aware the project was started on PC_1 on Visual Studio 2010 and later moved to Visual Studio 2013 Pro. There's one solution consisting of 19 projects. I have an instruction which says that in order to get the plugin installer I should first Build project_x and after that Build project_y_WiXInstall. Both steps work without any issues on this machine.
Then there's PC_2 which had Visual Studio 2015 Community installed before I started working on it. I've removed it, installed Visual Studio 2013 Pro (version 12.0.21005.1 REL - exactly the same as on PC_1), moved all of the needed files and I'm trying to get rid of all of the compilation errors. So far I figured out I had to install Cmake 2.8, Windows Driver Toolkit 7.1 and manually override an incorrect VCTargetsPath MSBuild variable
Problem description
Currently when I try to compile the project on the new machine I get these two errors (this is an image link since I can't embed images yet on this account). I'm not sure what's going on with the first error message since it looks incomplete and the file CUSTOMBUILD doesn't exist, but I'm not bothered by it too much since the previous compilation error I fixed also had a similar "artifact" as the first error and it disappeared after fixing the second one.
The covered part of the second error message is the project path. The error origin (Microsoft.Cpp.Platform.targets file, line 64) looks like this:
<!-- Error out if toolset does not exists in Visual Studio 2010 or 2012 -->
<VCMessage Code="MSB8020" Type="Error" Arguments="$(_CurrentPlatformToolsetShortName);$(PlatformToolset)" Condition="'$(ToolsetTargetsFound)' != 'true'" />
What didn't help
The error description suggests using an Upgrade Solution... option, but there's no such thing when I right-click the solution
As an accepted answer for the question I've posted at the start of my post suggests, I've checked the Properties of all 19 of my projects (including the project ZERO_CHECK) but their Platform Toolset is already set to Visual Studio 2013 (v120).
I've also tried changing the Platform Toolset to inherit from parent or project defaults for all of the projects. This resulted in it switching to Visual Studio 2010 (v100) (not installed) and after that I've right-clicked on the projects and chose Upgrade VC++ compiler and libraries. After this the Platform Toolset was back to the Visual Studio 2013 (v120) but it didn't help with the compilation error.
As a NON-accepted answer for the question I've posted at the start of my post suggests, I've tried searching for all of the occurrences of 10.0 and V100 in all of my .vcxproj files to replace them but I haven't found any occurrences of them.
[EDIT]
I just got an idea to try building the project with MSBuild from the command line. There's a bit more info compared to errors inside Visual Studio, so maybe it will help with resolving the issue: https://pastebin.com/JhN3dXM3
So the thing you're missing here is that FireBreath projects are built using CMake -- the actual contents of the build directory should always be completely temporary and never stored in source control. To build the project on a new computer you need to run the prep command again from scratch.
If the previous maintainer changed the build files manually and/or migrated it to a newer version of visual studio without using cmake to do it then they did some very ugly things and all bets are off... good luck.
This is why all the firebreath documentation (I wrote most of it) strongly urges that the build directory be transient and you always do project file updates in cmake.
Hope that helps!

how to recompile a .lib in Visual Studio 2013

I have a project that uses Effects11.lib and Effects11d.lib but when I build my project I get a bunch of "error LNK2038: mismatch detected for '__MSC_VER':value '1600' doesn't match value '1800'". And from what I have found, this is saying that the .lib was built for a different version of VS than what I am using and I need to recompile them. Issue is I am not sure how to do this. Never had to recompile a lib before.
Looking through the authors site for this book # http://www.d3dcoder.net/d3d11.htm, it looks like the Effects11.lib is Ms-Pl licensed source code.
http://msdn.microsoft.com/en-us/library/windows/desktop/ff728664(v=vs.85).aspx
which then links to
https://fx11.codeplex.com/
which has a download for the source of that library at
https://fx11.codeplex.com/releases/view/150822
which seems to have project files which are buildable with VS2013 which you are using so you should be able to build effects.lib for vs2013 and continue with your development.
Alternative you could contact the author himself from his webpage and see if he can do this for you and link to it as its likely you're not the only one hitting this issue?
To recompile a .lib file, you first have to have the source code. You then open the vcproject of the library project, and then you change your settings and then you can recompile. I also found on the web that for some types of c++ in order to get it to recompile, you will have to delete the .o file generated in the library's directory. But, I do not know if that applies to your compiler. I hope this answers your question.
Those static libraries are built with VS 2010, but you are using VS 2013. The link error is telling you that.
The fix in this case is to visit the Effects 11 site on CodePlex and then build a fresh copy of the Effects 11 with your VS 2013 compiler. Alternatively, you can use the NuGet package fx11_desktop_2013 which is the same version built for VS 2013.
Note that as you are using VS 2013 which includes the Windows 8.1 SDK with the somewhat dated Luna book, you may be trying to make use of the deprecated D3DX11 library. You can certainly do that with VS 2013, but you have to make some adjustments to the project include/lib paths to get it to work. See MSDN. The Effects 11 library version from CodePlex or NuGet has no dependencies at all on the legacy DirectX SDK.
I have some general notes about that book here as well.
For a complete list of D3DX11 alternatives, see Living without D3DX.

How to downgrade solution from Visual Studio 2010 to Visual Studio 2005?

I have a huge Visual Studio 2010 solution. I work with Visual Studio 2005, so I want to convert the solution to the desired version. Basically, it's a portable C++ code so it should compile on Visual Studio 2005 too. Changing the version in the *.sln file doesn't help because the *.vcxproj format is completely different from the old *.vcproj format.
Recreating the solution by hand is not an option because of its size. Also there may be some non-default compiler flags, dependencies, etc. that I don't know of (and I can't look through ALL this XML junk that I don't understand).
There is already a related question on How Do I Downgrade a C++ Visual Studio 2008 Project to 2005. However, the utility suggested there supports at most Visual Studio 2008.
Any suggestions?
It really totally sucks, that every proprietary IDE today thinks it needs to create its own project file format.
"Dear IDE developers, just use Makefiles and create a nice GUI for it so that also people without Makefile knowledge can use it!" In VS6 it was at least possible to import/export Makefiles, but not today anymore. And it was possible to use nmake for automated builds. No IDE needed to be installed, just the toolchain which could be grabbed by a simple checkout without installation.
I use CMake now. It's free, it's cross-platform, it is well supported in free IDEs like KDevelop, QtCreator, etc. It can generate Makefiles and Visual Studio projects.
So you maintain only one project source, the CMakeLists.txt file and can work with any IDE. No pain with different versions of Visual Studio or with other proprietary project file formats.
This way you can generate or VS projects for developing and you can generate Makefiles for commandline builds using nmake like in the good old days.
BTW, it's much easier to change settings in a CMakeLists.txt than clicking through various GUI dialogs. But this is a matter of personal preferences.
In my work made a utility which utilized the EnvDTE.dll and scanned a vcproj-file and optionally all vcproj-files within a sln-file. It compared all settings with a "template" and would issue a warning or optionally update the setting to correct values. We used this utility so that settings would be verified to be correct and consistent throughout all projects. I haven't updated the utility to 2010 yet due to other priorities.
EnvDTE hasn't changed much from Visual Studio 2008 to Visual Studio 2010. Perhaps it is possible to create a simple utility which opens the vcxproj-file using DTE100 and saves it using DTE90, or earlier.
Easiest way is probably to create a new project in VS 2005, and use the add existing item dialog to add the code to the project. I'd suggest using 'Empty Project' as the project type, so you don't have a lot of rubbish autogenerated for you that you'll just delete anyway.
I haven't tried it, but this looks promising:
http://www.emmet-gray.com/Articles/ProjectConverter.htm
edit: Nope, not promising, sorry :-(

Visual Studio 2008 Express MFC Support

As may be known by many, the Express versions of Visual Studio 2008 don't include support for MFC and a few other packages required to compile a lot of windows programs.
So, here's my problem:
I have the full version of Visual Studio 2005. I've been using this to compile a project that a friend of mine was working on, so that I could test it out for him and continue to track bugs and things. Recently, he upgraded that project to VS 2008, which I don't have. So, I downloaded the express version in the hopes that I could simply compile with that, but no luck, it complains about headers missing left and right.
It seems to me that since I already have the full version of VS 2005, I'm bound to have at least some (perhaps older) version of the files in question that his project needs to compile against.
Is there a way I can convince VS 2008 to also look in 2005's directories for include files and library files to compile against?
Furthermore, is this a bad idea? I would really prefer not to go out and purchase VS 2008 full, as I'll never use it myself. (2005 does the job fine for me at the moment, and I tend to prefer GCC anyway.)
Thanks
You can use the VC++ compiler directly from the command line, or just create a new project w/ the source in Visual Studio 2005. Unless he is using some functionality provided in the new versions of MFC/ATL in 2008/2008sp1, you should be able to compile the project just fine.
See ("Create Project from Existing Source") in Visual Studio 2005. It is unfortunate that they don't include these libraries with the Express Editions.
Use the vcvars*.bat script(s) from Visual Studio 2005. See this blogpost from VC++ Blog to see how. You will use the old compilers, but the build system from Visual Studio 2008.
You can go into Tools>Options>Projects and Solutions>VC++ Directories
and alter the Include, Library, and Source (and Reference maybe?) folders to use VC++ 2005's folders.
I'd guess you just replace $(VCInstallDir) with a hardcoded VS 2005 path. I'd record the original values before doing this.
However, have you just tried using the OLD 2005 sln and vcproj files? Keep using 2005 on your end and 2008 on his. Keep two sets of these files for each IDE. Any issues are going to be with the library mismatch - which you're not avoiding by using 2008's tools with 2005's libraries.
The simple way to deal with this would be to revert the solution and project files back to their visual studio 2005 state from source control(you are using source control right?). At this point you can compile the project as long as your friend does not use any of the mfc 9 only functions.
The first thing I would try is loading this up in VS 2005 by just modifying the version of the .sln and the .vcproj files. In the .vcproj change the version from 9.00 to 8.00 and in the .sln change the format version from 10.00 to 9.00.
If you don't have fancy stuff in the project you have a high chance of just being able to use it like this. Also this would avoid having to update 2 project and solution files.
On this website it is shown how MFC code can be compiled with the Visual Studio Express versions:
link
Just for the record, I've done that(by modifying the include directories and library directories from inside the IDE) and it's working pretty well, I have MFC, ATL, everything.
I've found this explanation. http://www.codeproject.com/Articles/30439/How-to-compile-MFC-code-in-Visual-C-Express