简体   繁体   English

Visual Studio编译器配置选项

[英]Visual Studio Compiler Configuration Options

I have recently inherited an old c++ project built in visual studio 2003 that consists of a lot of code that looks like this: 我最近继承了一个在Visual Studio 2003中构建的旧c ++项目,该项目由许多看起来像这样的代码组成:

for(int i=7;i<40;i++)
    title[i-7]=temp_title[i];
for(i=33;i<80;i++)
    title[i] = ' ';

However, since I do not have VS2003, I installed 2008 and now I am running into a lot of compilation errors due to i being an undeclared identifier since its out of scope. 但是,由于我没有VS2003,因此我安装了2008,由于我是超出范围的未声明标识符,因此我遇到了许多编译错误。 I am a complete novice to visual studio, how do I configure my project so it uses whatever compatible c++ compiler for 2003 so I can build the project and see what the heck its supposed to do. 我是Visual Studio的一个新手,我如何配置我的项目,以便它使用2003年兼容的任何c ++编译器,因此我可以构建该项目并查看其应做的工作。

@Kirill V. Lyadvinsky @基里尔诉Lyadvinsky

Yes, I do plan to fix the code, however, I'd like to have a base version that I can use to test against in case I mess something up since the person who wrote this is now retired (thankfully) 是的,我确实打算修复代码,但是,我想拥有一个基本版本,可以用来进行测试,以防万一我弄乱了东西,因为编写此文件的人现已退休(非常感谢)

You could use an option /Zc:forScope (Force Conformance in for Loop Scope) . 您可以使用选项/ Zc:forScope(For Loop Scope中的Force Conformance) Switch it off as in the picture below. 如下图所示将其关闭。 But I'd strongly recommend to fix the code so it will be conformant with current C++ Standard. 但是,我强烈建议您修复代码,使其与当前的C ++标准保持一致。

图片:200

/Zc:forscope-是您似乎正在寻找的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM