- UID
- 201333
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2004-12-10
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Using VC 7.1 (Visual Studio .NET 2003) to Build for AutoCAD 2000/2002/2004
Despite the minor numerical change from Visual C/C++ version 7 to 7.1, Microsoft made some major changes in the compiler and linker in order to become more C++ standard compliant. These changes make it virtually impossible to use 7.1 to build for ObjectARX 2004 and earlier ObjectARX versions. The new compiler chokes on the earlier versions of ATL and MFC libraries because they were not standard compliant, yet these are required when building for ObjectARX because of its reliance upon Autodesk libraries. What's more, the tricks outlined above are not enough to solve this problem.
The new features in the VC 7.1 IDE (not to mention the bug fixes) make it more desirable than VC 7. For that reason I wrote VC Build Hook, a small add-in* for VC 7.1 that solves the compiler version problem by automatically switching the environment path to the VC 7 build tool directories at build time. This causes the build process to use the VC 7 build tools instead of the incompatible ones that shipped with VC 7.1. Note that you must have Visual C/C++ 7 installed in order for the path switching to work. If you only have Visual C/C++ 7.1 available, you must purchase the downgrade to Visual C/C++ 7 and install it also, otherwise the required VC 7 build tools won't be available on your system. This feature can be enabled for an entire solution or for individual projects.
VC Build Hook provides another useful fringe benefit: it sets the build process to idle priority, thus making other processes more responsive while a build is in progress. This feature can be enabled or disabled by changing an extended property in a Visual Studio solution.
* WARNING: This is my first attempt at writing a Visual Studio add-in. I advise users of this add-in to save early and often. In any case, I cannot be responsible for lost work caused by bugs in VC Build Hook! Proceed at your own risk!
To install this utility, simply download VCBuildHookSetup.msi (172k) and install it by selecting 'Open'. Once VC Build Hook is installed, you can enable or disable it in the Visual Studio 'Add-in Manager'. By default VC Build Hook will start every time Visual Studio starts. Use 'Add/Remove Programs' in Control Panel to completely uninstall VC Build Hook and remove its files.
Download: VCBuildHookSetup.msi (175k)
Version 1.1.1.0 uploaded 2004-04-13
To use VC Build Hook, you must first follow the steps outlined elsewhere on this page to ensure that your project uses the correct headers and libraries. Open a solution in Visual Studio, then open the property grid window and select the solution in the solution explorer window. If VC Build Hook is started, you should see two new properties: 'LowPriorityBuild' and 'UseVC7Paths'.
Set the new VC Build Hook extended properties to 'Yes' to enable the corresponding feature for the selected solution. Set the property to 'No' to disable it, or 'Default' to use the default setting. These settings persist with the solution (they are saved in the 'Globals' area of the solution file.) The 'UseVC7Paths' property may also be set for individual projects within a solution. Any project setting other than 'Default' will override the solution setting.
--------------------------------------------------------------------------------
Enabling IntelliSense and Class Browsing for ObjectARX Headers
A common complaint among ObjectARX programmers is that Visual C/C++ doesn't display IntelliSense context menus for classes defined in the ObjectARX headers. The trick is to include all the ObjectARX headers files somewhere in your solution. I created a new folder called ARXHeaders with subdirectories for every version of the ObjectARX SDK:
ARXHeaders
ARX2
ARX202
ARX2000
ARX2000i
ARX2002
ARX2004
ARX2005
In each subdirectory, create a new empty static library project named e.g. 'ARX2005' and add every header file (*.h) from that version of the ObjectARX SDK to the project. It's important to give each project a unique name so that the project names don't collide when more than one is added to a single solution. Since there are no source files, there is no output file for these projects, and building them is a no-op. Nevertheless, adding one of these projects to an existing solution causes VC to "see" the ObjectARX classes and code definitions for use in IntelliSense. Another benefit of including the ObjectARX headers in the solution is the ability to use the class browser in VC to browse the ObjectARX SDK. Browsing can reveal some interesting undocumented functions, and it also proves very useful for providing a readable overview of class hierarchies and object definitions.
In projects that target multiple versions of AutoCAD (and therefore use multiple versions of the ObjectARX SDK) you can add the ARXHeaders project for each target version of ObjectARX. While adding multiple SDK versions won't tell VC which version of the SDK is used in a given source file or project, it does make each version separately available in the VC class browser for easy browsing. |
|