compiling VS6 C++ in VS2005 using a makefile

compiling VS6 C++ in VS2005 using a makefile

Post by MBB » Fri, 28 Jul 2006 03:05:46

hello, all,

i'm not sure if this is the correct place to post but...

i am a VS6 C++ dev with a big (to me) project that needs to migrate to VS2005.
i would like to compile my existing code in the VS2005 IDE (or at least using
the VS2005 compiler) to produce two ATL COM servers. both components statically
link to a lib.

i have used VS2005 to create simple C# applications so have some familiarity
with it but i need to understand more about C++ code in this dev environment.

as a first step, i thought i would try to compile the code that creates the lib.
i do not have a project file, just a make file.
can anyone explain how to trigger this make file...that is,

1. can it be "run" from the VS2005 ide?
2. if i run it from the command line, are there new switches that need to be set?
3. is nmake available in VS2005?

also is there a favorite reference for "compiling VS6 C++ code in VS2005"?
i have looked at Grimes' book but it focuses on managed extensions.
i *think* i want to stick with native code...if that's the right terminology.

any help is appreciated.
i expect this to be an iterative process with much suffering on my part ;=)


compiling VS6 C++ in VS2005 using a makefile

Post by Arnaud Deb » Fri, 28 Jul 2006 07:20:45

Don't you have a .dsw or .dsp file for this library? If you have, you can
simply open it in VC2005, it will be converted to a .vcproj 2005 projet.

If you really want to stick with makefiles (but why???), I don't thing nmake
has changed much (if at all) from VC6 to VC2005.

In your situation, I would create a blank Win32 library project, and add
manually all the source files and headers from the library, then set the
corresponding compilation options (#defines, etc...).
I do not see any advantages to stick with makefiles when the new .vcproj
format is documented. What is more, if you've got a multiprocessor box, VC
IDE is able to take advantage of it by parallelizing some builds (at the
project level), something that nmake is unable to do.



compiling VS6 C++ in VS2005 using a makefile

Post by jpetran » Sat, 29 Jul 2006 01:33:09

rnaud Debaene wrote:

I'm following this with interest. I also have a VS 6.0 application that
I wish to migrate to VC2005, and we do take advantage of nmake to
build, for the simple reason that we want to have automatic builds.
This application also happens to be tied to an embedded software effort
that uses a cross compiler and nmake to build; it is enormously useful
to build the Windows app with the same mechanisms. These are makefiles
written by hand. The application is a debug monitor that we use to get
log information from the target and to exercise the hardware on the

I was hoping to simply convert our .dsw and .dsp files to .sln and
..vcproj files and have a smooth transition. Unfortunately I've found
that there is one difference from VS 6.0 and VC2005; the ability to
generate .dep files (part of exporting makefiles) was removed from
VC2003 and later. While we don't need these separate dependency files
to build the application itself, because the .dsp files keep track of
them, we do use them when packaging up source code to give to customers
with which we co-develop. We don't want to give them all of our source
code, but we do need to give them what is required to compile with. The
monitor app includes some of the firmware header files, so when we give
them debug monitor files for their own development we need to know
which firmware header files to make part of the delivery. We use the
..dep files, generated by VS 6.0, for this. (We wrote a macro to create
the .dep files from within the makefile.) Unfortunately we can't do
the same thing with VS2005, because it can't generate .dep files. The
cl.exe compiler from VS does not generate dependencies either, unlike
some other compilers I know of (but neither does our cross compiler,

My options as I see them:
a) use the cl.exe's /showincludes option to spit out include info.
Unfortunately this output also spits all the windows libraries, and it
goes to stdout along with all the errors and warnings, making those
hard to pick out. The output also goes to a BuildLog.html, which we
would have to write a script to parse and create the .dep files we
need. We could use an awk script to only put in this option when we're
packaging a delivery. (awk is part of our standard devlopment
environment) This is kludgy and brittle, but it would be the path of
least change.

b) Move the dependencies out of the VC project files and into the
makefiles, where we'd have to update them by hand. Ick.

c) Compile with a compiler other than cl which will generate .dep
files, although it won't generate the debug symbols used by the IDE. We
like the VS IDE for debugging; it rocks, so we don't want to give that
up. Maybe we could only do that for delivery builds and not for others.
The problem with that is that cygwin isn't part of our standard
development environment, and the compiler I'm thinking of would have to
be run in cygwin.

d) Divorce ourselves from MS tools and use gmake, gcc, and mingw. The
downside of that is that we wouldn't get to use the excellent VC IDE,
and it would also be a big change for developers here. This is not a
decision to be made lightly.

Can you think of anything I missed? If I could get the /showincludes
to dump to a file and not to stdout, that would be terrific, but I
don't think it can. Or, is there a way to extract the dep info from
the .vcproj files? I took a look at them but it doesn't seem the

compiling VS6 C++ in VS2005 using a makefile

Post by Arnaud Deb » Sat, 29 Jul 2006 06:24:42


As I have said, there is no changes in nmake from Visual 6 to Visual 2005.
On the other hand, Visual 2005 can be called from console (and therefore
from automatic build tools) to build a solution : see

Yes, I know... too bad MS really never implemented this functionnality in a
nice, usable way:-( When I need this kind of things, I use a Perl script (or
something similar -awk might be a solution) to build the .dep file. There
are plenty of such tools floating the Internet.


compiling VS6 C++ in VS2005 using a makefile

Post by MBB » Sat, 29 Jul 2006 06:46:53

does that mean i would have to add the /clr switch to the compiler invocation in
the .mak file?
that is, the compiler name is the same?

merci ;=)

calling from the console to do "automatic" builds is a nice option.
this might eliminate one annoying aspect of VS6 dev: modifying the MS generated
mak file so it can be invoked by the build machine (and maintained by a mere

as i mentioned in my initial post, i have no project file for the lib.
but i think your first suggestion to just create a lib project in VS2005 is
probably the simplest way to go.

thanks for the information,

compiling VS6 C++ in VS2005 using a makefile

Post by Carl Danie » Sat, 29 Jul 2006 11:58:32

No - only add the /clr switch if you want to compile as managed code. From
what you've described, you don't.

Yes, it's still cl.exe. The vast majority of the command line options are
the same. There are a few new ones, and a few have been removed. As a
first try, "just do it". The compiler will gripe about obsolete switches
(if you're using any of them) and you'll have a place to start looking.

That's usually the easiest solution for a library unless there's something
unusual about the structure that makes the simple project inappropriate
(e.g. lots of include directories, with different directories needed for
different sets of files).


compiling VS6 C++ in VS2005 using a makefile

Post by Arnaud Deb » Sat, 29 Jul 2006 15:31:11


If you wants to target .NET, yes, but I do not believe this is the case...

Yes, cl.exe. Some compiler flags have changed, some settings may need to be
adjusted, but on the whole it won't change a lot of things.