Makefiles, moving from VC6 to Visual Studio 2010 - c++

I'm trying to migrate some projects from VC6 to Visual Studio 2010 but I'm running into issues with makefiles - at the moment they don't work! (Which was expected).
Any ideas or pointers how they should be written now (before it was a line beginning with msdev... which cannot be found now, is there an up to date equivalent to use? I read about vcbuild but I believe this is not present in VS10).
Is it possible to just build a whole project in one line?
i.e. the current line to build is:
msdev project.dsp /MAKE "$(component) - Win32 Release" /build
Any ideas what this would change to?

VS2010 no longer uses DSP style projects. The project file format has changed radically since VC6. The extension now is vcproj, not dsp.
Your best bet is to migrate the project to VS2010 format by opening it in the new IDE, and make sure it builds and runs OK there. Note that some working VC6 code will not compile in VC10 since the newer compiler is strongly conformant, while the old was not. Then, try the command line build using the resulting project.vcproj file.
I'm not sure if VS2010 will recognize and import VC6 projects. If not, then you can use Create Project from Existing Code to create a VS2010-style project from your source. This is going to be harder than just opening the old DSP file, but still easier than manual migration of all the DSP settings into a valid VS2010 vcproj file. If you are on VS2010 Express, then even this is out since that option is only in paid versions.

The VS2010 app name is devenv. From the command line, as long as you've run the right vcvars32.bat file, just type devenv /? to get the command line build help. Essentially, it's:
devenv solutionfile.sln /Build "Release"
So once you upgrade your projects and create a solution, you should be ok. There may be a way to build a project without a solution file, but I don't know how to do that.

Related

MSVCR100D.dll error at runtime

Ok , so i created a program using VC++ 2010. it ran just fine.
Got to work and could only install vc++ 8 due to having a crappy computer that is still stuck on xp sp2...
Everything will link up and build with no errors, But when the program starts to run i get "This application has failed to start because MSVCR100D.dll was not found"
I tried changing the runtime libary from MDd to MTd but still no luck...any idea?
That DLL comes with Visual Studio 2010. If you want to use your program, you'll somehow have to get your hands on it. If possible at your work, you can download it. Another (probably better) option would be to take it with you from home on a USB drive.
Edit: You can also try re-creating the project, and then copying the source code over into the new project. Your newly created project (in Visual Studio 2008) should not be depending on that erroneous DLL.
Edit 2: As Hans Passant added in a comment, this DLL is needed by Debug compilations of your program. So if you simply compile as Release, you can safely ignore the first part of my post. (I hope I'm not breaking gentleman rules by adding this to my post.)
MSVCR100D.dll is for debug mode, and is installed with visual studio 2010, since 2008 has MSVCR80D. You can just google that and download it, and put it in the same direcrory, or just complie in release mode.
here is a download link. You need the small download zip file button, not the big ones.
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100d
As I know, MSVCR100D is debug version of runtime library used by VC2010。So, if your point either is:
(1) you do not have that dll which you really need, you can download at http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100d or
(2) you want to run that program without requirement of MSVCR100/D.dll, you may need to recreate a project in VC8, then substitute with your source files (not solution file or other files managed by Vistual Studio).
FYI: If my memory were not going wrong, I remember that a project created by higher version of VS cannot be opened directly by lower version one. So, how did you build them?

Converting VC++ Solution and Project files from 32 to 64 bit

Does devenv through any switch or any tool allow to convert a Visual Studio Project and Solution from x86 to X64/AMD64? I was particularly thrilled with the switch /Upgrade in devenv which automatically upgrades a solution/project from previous version to the current version and was looking forward for something similar to do a bitness conversion.
I have a set of vcxproj that I want to port from 32 bit and 64 bit. The process I understand should be straight forward as it only have to create a new configuration for x64, copy the settings for both Win32 Debug/Release and then do a blind replace of all the CRT/MFC libraries/dlls and toggle few switches to make it a 64 bit build.
Hacking through the vcxproj and sln files may be an option but I do not want to invest time and reinvent the wheel if one already exist.
Note If it matter's, currently my focus is only for Visual Studio 2010.
You don't need to "upgrade" your Project files from Win32 to x64. Just go into configuration manager for your solution and add an x64 platform for the project configurations that need it.
I wrote a python script to do it manually, kinda hacky but it seems to work :)
Pretty straight forward since both the solution and project files are plain text. At first I did it via configuration manager, then I diffed the files and did the same procedure in python.
In my case (protobuf 2) it was only a few 'replace all's.
in both sln and project replace Win32 with x64
in project replace
<TargetMachine>MachineX86</TargetMachine>
with
<TargetMachine>MachineX64</TargetMachine>
and
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
with
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
and finally change the OutDir so my cmake Find scripts pickup the build
Full source https://github.com/madeso/ride/blob/f7d7234972aeaa0ddb89cda030ecfe651678078d/scripts/windows.py#L163

How to move old VC6 project to VS2010 using Daffodil

I've been interested in this project lately.
I have an old legacy project made in VC6, which I hear is a great IDE but doesn't run smoothly on my machine. I also don't know how to work with it. A full blown move to a 2010/12 project is a big time spent so I wonder:
Can someone share some basic information on how to use this tool? I've been searching a lot and couldn't find anything more comprehensive than the site.
Which specific old VC6 tools do I need to make sure to have working for Daffodil? (compiler, linker, etc) where are they located on the installed machine?
To build your project in VS 2010:
Make sure the VC 6 build tools are installed and working.
Make sure VS 2010 and Daffodil are installed and working.
Open your VS 6 workspace in VS 2010.
A. In Explorer, right-click on your VS 6 workspace (*.dsw) file.
B. Choose Open With -> Microsoft Visual Studio 2010.
C. Perform the migration when prompted.
Change the Platform Toolset to v60.
A. Right click on the project(s) and select Properties.
B. On the General page, set Platform Toolset to v60.
Build.
A quick read tells me that the concept of "Daffodil" is to use the VC6 compiler with the VS2010 IDE. Therefore, you wouldn't run VS6 on your machine. You just need the VC6 compiler and linker.
Start by letting Vs2012 migrate the project and see what doesn't work properly. The newer compilers are much better -once you've gone through the pain of the conversion.

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 :-(

Build Process for a Visual C++ 2008 Express Project

I have a VS 2008 C++ project, with one very small and simple code file. I need to write an app to generate this file and build the project into a Win32 DLL. I will need to deliver a free compiler etc. with the app to my client, so I can't automate VS to do this.
How would I best go about this?
VS 2008 Express installs the command line compiler (in fact the installer has an option so you only get the command line stuff). So getting a free compiler is no problem.
If you really only need to build a single file into a DLL, a cl command using the '/LD' option should be enough to do the trick (though you'll likely need at least a couple other options).
If you want to get fancy, I'm not sure if The Express SKU includes nmake.exe (but I imagine it does).