zoukankan      html  css  js  c++  java
  • 再谈VS2010编译更高平台vs2012(v110),vs2015(v140)的objectARX程序

             前段时间我贴了一篇vs2010批量编译vc6~vs2008的ARX版本,实际上那一篇是我在研究vs2010编译v110,v140平台的附带收获,正应了那句话,有心栽花花不开,无心插柳柳成荫,因为vs2010编译更高版本的ARX目前需要的平台集是v110(vs2012,2013)和v140(vs2015,2017),分别对应CAD的R20(cad2015,2016),R21(cad2017,2018),而WindowsXp仅仅支持vs2010,所以必须使用win7以及以上的系统才能实现批量编译。

    准备vs2012,vs2015绿色便携版,或者安装版。

    绿色便携版下载地址,vs绿色便携版下载

    下面我们来提取编译器,实际上vs开发工具集成编译环境IDE包含编辑器和编译器,而我们仅仅需要vc编译器+必要的windows SDK即可实现编译,

    1,打开便携版目录,我们主要关心这两个文件夹。

    先打开common7IDE

    找到以下4个文件,右键复制

    进去VCin目录,粘贴,如果提示重复,可以跳过不覆盖。

    在这个文件夹下面运行以下cl.exe,link.exe等exe,看是否能运行,可以打开cmd运行拖动exe到cmd中执行。。。。

    已经能够提示用法,表示这个exe程序可以正常执行,其他的一样的可以测试一下。

    下面我们为vs2010添加新的平台集,v140

    打开如下路径

    C:Program Files (x86)MSBuildMicrosoft.Cppv4.0Platformsx64PlatformToolsets

    新建两个文件夹,v140,v110

    进入v90,选择这两个文件复制到v140,v110

    粘贴到v140后,修改这两个文件的名字v90改v140

    然后用记事本或者notepad++打开这两个文件。

    替换所有v90文本为v140

    找到这个文件的第一个<VCInstallDir>

     将目录改成你的vs2015的vc目录,如:E:Visual Studio 2015 EnterpriseVC ,注意最后的斜杠。

    我这个文件后面还有一个 <VCInstallDir Condition="'$(VCInstallDir)' == ''">d:vcvc9</VCInstallDir> 这句可以不要,可以删除。。

    按照上次的例子添加相关项目,如图。

    现在我们可以用vs2010新建一个项目测试测试,看看有什么问题。。

    更改项目平台为v140

    直接编译。

     用everything搜索一下。

    这个是我win10系统下的目录,因为我这台电脑上没有安装vs2015相关的windwos SDK,所以无法找到这个文件。。

    所以必须找到一份windws10的SDK,因为我已经有了,我就不去折腾了,自行百度解决吧。而且这个文件夹有1.78G,不好上传。

    回归主题,继续编辑Microsoft.Cpp.X64.v140 这个文件,找到第一个<WindowsSdkDir 后面的路径改为winsows10 SDK的路径如。

    G:Program Files (x86)Windows Kits10

    再次编译。

    这个是winver版本设置低了的缘故。打开项目文件的stdafx.h

    替换一下

    #if _MSC_VER < 1300
    #define WINVER 0x0400
    #elif _MSC_VER > 1500 // vc9
    #ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
    #define WINVER 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
    #endif
     
    #ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
    #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
    #endif
     
    #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
    #define _WIN32_WINDOWS 0x0501 // Change this to the appropriate value to target Windows Me or later.
    #endif
     
    #ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
    #define _WIN32_IE 0x0601 // Change this to the appropriate value to target IE 5.0 or later.
    #endif
    #else
    //- Modify the following defines if you have to target a platform prior to the ones specified below.
    //- Refer to MSDN for the latest info on corresponding values for different platforms.
    #ifndef WINVER          //- Allow use of features specific to Windows 95 and Windows NT 4 or later.
    #define WINVER 0x0400      //- Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
    #endif
    
    #ifndef _WIN32_WINNT      //- Allow use of features specific to Windows NT 4 or later.
    #define _WIN32_WINNT 0x0400    //- Change this to the appropriate value to target Windows 2000 or later.
    #endif            
    
    #ifndef _WIN32_WINDOWS      //- Allow use of features specific to Windows 98 or later.
    #define _WIN32_WINDOWS 0x0410  //- Change this to the appropriate value to target Windows Me or later.
    #endif
    
    #ifndef _WIN32_IE        //- Allow use of features specific to IE 4.0 or later.
    #define _WIN32_IE 0x0400    //- Change this to the appropriate value to target IE 5.0 or later.
    #endif
    #endif
    

      

     再次编译

     启动调试

    测试一下断点。

    正常。。

    至此,v140x64编辑完成,同样的方式,win32,v110都是类似的。。不再重复。。

    附 上完整的x64 prop文件,仅供参考。

    <!--
    ***********************************************************************************************
    Microsoft.Cpp.x64.v140.props
    
    WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
              created a backup copy.  Incorrect changes to this file will make it
              impossible to load or build your projects from the command-line or the IDE.
    
    Copyright (C) Microsoft Corporation. All rights reserved.
    ***********************************************************************************************
    -->
    
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <Import Project="$(VCTargetsPath)Platformsx64PlatformToolsetsv140ImportBefore*.props" Condition="Exists('$(VCTargetsPath)Platformsx64PlatformToolsetsv140ImportBefore')" />
    
      <PropertyGroup>
        <PlatformToolsetVersion>90</PlatformToolsetVersion>
    
        <VSInstallDir>$(Registry:HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio10.0SetupVS@ProductDir)</VSInstallDir>
        <VSInstallDir Condition="'$(VSInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftVisualStudio10.0SetupVS@ProductDir)</VSInstallDir>
        <VSInstallDir Condition="'$(VSInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINESOFTWAREMicrosoftVCExpress10.0SetupVS@ProductDir)</VSInstallDir>
        <VSInstallDir Condition="'$(VSInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftVCExpress10.0SetupVS@ProductDir)</VSInstallDir>
    	
    	<VCInstallDir>E:Visual Studio 2015 EnterpriseVC</VCInstallDir>
    	<MyARXDir>C:ObjectARX 2017</MyARXDir>
    	<MyPlatform>x64</MyPlatform>   
       
    
        <WindowsSdkDir Condition="'$(WindowsSdkDir)' == ''">G:Program Files (x86)Windows Kits10</WindowsSdkDir>
        
    
        <FrameworkDir Condition="'$(UseEnv)' != 'true'">$(Registry:HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETFramework@InstallRoot)</FrameworkDir>
        <FrameworkDir Condition="'$(FrameworkDir)' == ''">$(Registry:HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoft.NETFramework@InstallRoot)</FrameworkDir>
    
        <FrameworkSdkDir Condition="'$(UseEnv)' != 'true'">$(Registry:HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SDKsWindowsv6.0A@InstallationFolder)</FrameworkSdkDir>
        <FrameworkSdkDir Condition="'$(FrameworkSdkDir)' == ''">$(Registry:HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SDKsWindows@CurrentInstallFolder)</FrameworkSdkDir>
        <FrameworkSdkDir Condition="'$(FrameworkSdkDir)' == ''">$(Registry:HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv6.0A@InstallationFolder)</FrameworkSdkDir>
        <FrameworkSdkDir Condition="'$(FrameworkSdkDir)' == ''">$(Registry:HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindows@CurrentInstallFolder)</FrameworkSdkDir>
    
        <FrameworkVersion Condition="'$(UseEnv)' != 'true'">v2.0.50727</FrameworkVersion>
        <Framework35Version Condition="'$(UseEnv)' != 'true'">v3.5</Framework35Version>
    
        <ExecutablePath Condition="'$(ExecutablePath)' == ''">$(VCInstallDir)binx86_amd64;$(VCInstallDir)bin;$(WindowsSdkDir)bin;$(VSInstallDir)Common7Toolsin;$(VSInstallDir)Common7	ools;$(VSInstallDir)Common7ide;$(ProgramFiles)HTML Help Workshop;$(FrameworkSDKDir)bin;$(FrameworkSDKDir)libwin64;$(FrameworkDir)$(FrameworkVersion);$(FxCopDir);$(PATH);</ExecutablePath>
        <IncludePath Condition="'$(IncludePath)' == ''">$(WindowsSdkDir)Include10.0.15063.0um;$$(WindowsSdkDir)Include10.0.15063.0winrt;$(WindowsSdkDir)Include10.0.15063.0ucrt;$(WindowsSdkDir)Include10.0.15063.0shared;$(MyARXDir)inc;$(MyARXDir)inc-x64;$(VCInstallDir)include;$(VCInstallDir)atlmfcinclude;$(WindowsSdkDir)include;$(FrameworkSDKDir)include;</IncludePath>
        <ReferencePath Condition="'$(ReferencePath)' == ''">$(VCInstallDir)atlmfclibamd64;$(VCInstallDir)libamd64</ReferencePath>
        <LibraryPath Condition="'$(LibraryPath)' == ''">$(WindowsSdkDir)Lib10.0.15063.0umx64;$(WindowsSdkDir)Lib10.0.15063.0ucrtx64;$(MyARXDir)lib-x64;$(VCInstallDir)libamd64;$(VCInstallDir)atlmfclibamd64;$(WindowsSdkDir)libx64;</LibraryPath>
        <SourcePath Condition="'$(SourcePath)' == ''">$(VCInstallDir)atlmfcsrcmfc;$(VCInstallDir)atlmfcsrcmfcm;$(VCInstallDir)atlmfcsrcatl;$(VCInstallDir)crtsrc;</SourcePath>
        <ExcludePath Condition="'$(ExcludePath)' == ''">$(VCInstallDir)include;$(VCInstallDir)atlmfcinclude;$(WindowsSdkDir)include;$(FrameworkSDKDir)include;$(FrameworkDir)$(FrameworkVersion);$(VCInstallDir)atlmfclibamd64;$(VCInstallDir)libamd64;</ExcludePath>
        <NativeExecutablePath Condition="'$(NativeExecutablePath)' == ''">$(VCInstallDir)binAMD64;$(VCInstallDir)VCPackages;$(WindowsSdkDir)binx64;$(WindowsSdkDir)binwin64x64;$(WindowsSdkDir)bin;$(FrameworkDir)$(FrameworkVersion);$(FrameworkDir)$(Framework35Version);$(PATH);</NativeExecutablePath>
      </PropertyGroup>
    
      <Import Project="$(VCTargetsPath)Platformsx64PlatformToolsetsv140ImportAfter*.props" Condition="Exists('$(VCTargetsPath)Platformsx64PlatformToolsetsv140ImportAfter')" />
    </Project>
    

      

  • 相关阅读:
    测试
    unittest发送测试报告邮件
    unittest生成测试报告
    Navicat连接Oracle详细教程
    Windows 2012 安装 Oracle 11g 报错:[INS-13001]环境不满足最低要求。
    Windows server 2012安装oracle11g(32/64位)步骤
    ElasticSearch和solr的差别
    HashMap和Hashtable的区别
    final关键字所修饰的类有什么特点
    springboot测试的时候插入数据: error performing isolated work; SQL [n/a]; nested exception is org.hibernate...
  • 原文地址:https://www.cnblogs.com/edata/p/8061127.html
Copyright © 2011-2022 走看看