Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
380 views
in Technique[技术] by (71.8m points)

compilation - Is it possible to use the VC++ 6 compiler in Visual Studio 2012?

I am using Visual Studio 2012 to develop my projects, and I also have installed Visual Studio 2010 - which gives me the option to use the VC++10 compiler in Visual Studio 2012 (project properties), but I also have installed Visual C++ 6 and somehow the option to use the VC++6 compiler is not present in Visual Studio 2012, how do I add this option (manually)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The answer is definitely maybe. It seems quite possible, but I could not get a copy of VC 6 so I was unable to verify it. What I was able to do was to get VS 2012 to use VC 7 (VS 2002) to compile a project.

Update: The answer is definitely yes. The OP indicates in the comments that he was able to get VC 6 working by using this solution.

Configuration

The way I did this was to install the following (in order of install):

Windows 7, SP1, 32 Bit

I chose Windows 7 because it is the earliest version of Windows that will support VS 2012. I used a 32 Bit version because VS 2002 (VC7) would not install on an x64 machine.

Visual Studio 2002, SP1

As I mentioned, I could not get VC6. It was no where to be found on Microsoft's site. Bruce's comment under this question provides this helpful insight:

Visual C++ 6.0 isn't available (including via MSDN) from Microsoft because it included the Microsoft JVM. See this link for details. – BruceCran

After seeing the above, I figured that installing VS 2002 (VC 7) was the next best thing.

Obviously, this is where you would install VC 6, if you have a copy1.

1I should note, for anyone that is interested, that VC 6 is available on Ebay. If I were being paid in actual currency instead of points I would have gone the extra mile and gotten a copy of VC 6 to test.

Visual Studio 2010, SP1

The only reason for this is that it is a requirement for Daffodil. More on Daffodil below.

Visual Studio 2012, Update 2

This is a requirement from the original question.

Daffodil

This is a set of configuration files that allows VS 2010 and VS 2012 to target older VC compilers.

Currently, these are the supported VC compiler versions:

  • VC 8 (Visual Studio 2005)
  • VC 7.1 (Visual Studio 2003)
  • VC 7 (Visual Studio 2002)
  • VC 6 (Visual Studio 6)

I should note that Daffodil does not officially support VS 2012 as an IDE, but it does seem to work. From the Daffodil site:

Daffodil works fine in VS 2012 and later versions2 as long as VS 2010 is also installed.

2 There appears to be a debugging problem when using VS 2013 and VS 2015, as noted here:
Debugging information does not match, when using v60 platform toolset inside Visual Studio 2013

Testing

To test the above I created a new C++ Win 32 console project in Visual Studio 2012. I then removed all header and cpp files from the project - these have things that are VS 2012 specific, so were not needed. I then added a simple "hello world" file that I could use to test:

#include <iostream.h>

void main()
{
   cout << "Hello World!" << endl;   
}

Using the project as is (targeting VS 2012), I tried to build it and it failed.

Next, I right-clicked the project and selected properties. I selected Configuration Properties on the left side of the dialog, and then under Platform Toolset, on the right, I selected v70. You will note that there is also an option for v60:

Test Project Properties

I then saved the change to the project and did a build. It built an exe successfully. Just to verify that VC 7 was being used, I launched Process Monitor during the compile:

Process Monitor during Compile

As you can see cl.exe, the compiler, is being called from the VC 7 directory.

Final Thoughts

The original question involves compiling an existing VC 6 project. Just a couple of notes on this.

My guess is that for retargeting to work, that you will have to create a new empty project in VS 2012, and then add in all of the existing source files. The reason for doing this is that obviously the project format is different between the two versions of Visual Studio.

As I mentioned, I tested using VC 7 instead of 6. I suppose the last step is for the OP to try all of this using VC 6. Hopefully it all works.

Links


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...