Solved

Visual Studio 9 C++ Project to be compiled as VC8

Posted on 2009-03-31
7
1,251 Views
Last Modified: 2013-12-14
I'm using Visual Studio 2008 and Visual C++.
When I deploy my project (Native C++ codes, using "Empty Project" type in project creation wizard), VC9 run time files (e.g. Microsoft.VC90.CRT) should be present on the host computers, as I checked, for VC8, the run time files are already included with Windows XP.

How can I use Visual Studio 2008 to compile the project using VC8 run time files, instead of VC9?

(I am not planning to downgrade to Visual Studio 2005!)
0
Comment
Question by:Mortaza Doulaty
7 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 24026715
>>How can I use Visual Studio 2008 to compile the project using VC8 run time files, instead of VC9?

Sorry, no can do.
You need to either downgrade or to distribute the VC9 runtimes with your app.
0
 
LVL 19

Expert Comment

by:alb66
ID: 24026759
>>>> for VC8, the run time files are already included with Windows XP

IMO they were installed on the PC by an application, not by the OS itself.

The best solution is to distrubite the VC9 runtimes with the app:
http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&displaylang=en
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 500 total points
ID: 24027203
>>>> I am not planning to downgrade to Visual Studio 2005!

Why not? If not using the Vc9 enhancements you should be able to build the same project by both compilers (the only thing to change - temporaly - is the VC version in the .vcproj files. You must not downgrade in the IDE but only make the final built with VC8.

0
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
LVL 12

Author Comment

by:Mortaza Doulaty
ID: 24027547
itsmeandnobodyelse:

>> (the only thing to change - temporaly - is the VC version in the .vcproj files
How could this be done?
Just open the .vcproj file in a text editor and change the version number?
Then open in VS2005 and compile it, and then re-do the change in the .vcproj file to make it back to vs2008.
Is this what you mean?

If not, would you please describe a little more...

Thanks.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 24027832
in addition to
>>You must not downgrade in the IDE but only make the final built with VC8.
I would suspect that you would also not use ANY of the new implementations in MFC supplied with VS2008.  Interesting idea however.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24029268
>>>> Just open the .vcproj file in a text editor and change the version number?
I would do it programmatically by copying the original .vcproj to a new file and  updating the version number to VC8. After that set the VC8 environment (PATH, INCLUDE, LIB) for VC8 and call the VC8 vcbuild passing the new project filename.

That way you would not miss any new project settings.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 24030147
The console prog below probably would do the version update.

you could call the prog in a command file passing full path of VC9 .vcproj and a path to a the temporary  VC8 .vcproj.

Then, set PATH,INCLUDE,LIB environment variables so that they fit to VC8 and use vcbuild to make a commandfile build.

Note, check your vcproj that it doesn't contain paths pointing to VC9 folders. If so, you might change these settings - if possible - to use macros which you could switch from VC9 to VC8 and vice versa.

#include <fstream>
#include <string>
using namespace std;
 
int main(int nargs, char* szargs[])
{
   if (nargs <= 2) return -1;
   string line;
   ifstream ifs(szargs[1]);
   ofstream ofs(szargs[2]);
 
   bool versionUpdateDone = false;
   int  versionPos        = 0;
   while (getline(ifs, line))
   {
      if (versionUpdateDone == false && 
          (versionPos = (int)line.find("Version=")) != string::npos)
      {
         int pos1 = (int)line.find('"', versionPos);
         int pos2 = (int)line.find('"', pos1 + 1);
         if (pos1 == string::npos || pos2 < pos1 + 1) return -2;
         line = line.substr(0, pos1) + "8.00" + line.substr(pos2);
         versionUpdateDone = true;
      }
      ofs << line << endl;
   }
   ifs.close();
   ofs.close();
 
   return 0;
}

Open in new window

0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
.Net Errors Service Crashing 5 123
VS2015 compilation and missing DLLs 9 147
Visual Studio 2010 There is no editor available for ... 8 89
Path to  STL Map header file 1 58
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question