Using VC build hook to target multiple AutoCAD versions.

Source: Internet
Author: User
Tags visual studio 2010

Using VC build hook to target multiple AutoCAD versions

[Update: Visual Studio 2010 now using des a built in feature called Native multi-targeting that replaces the need for VC build hook. ReadThis blog postTo learn how to use vs 2010 to target older versions of Visual Studio.]

I createdVC build hookUtility in order to make it possible to use the current Visual Studio IDE for building ObjectARX applications that target any version of AutoCAD. this is desirable because ObjectARX applications must be built by the visual C/C ++ build tools that correspond to the ObjectARX SDK version for the target AutoCAD version.VC build hookWorks by switching the executables path during a Visual Studio build and pointing the paths to the desired version of the Visual C/C ++ build tools. In addition,VC build hookAutomatically fixes build tool command options to account for differences between VC versions so that build commands produced by one version of Visual Studio are correctly interpreted by another version of the build tools. assuming you 've already set up your projects as described here (note that youMustHave a working installation of the necessary version of Visual C/C ++ build tools and runtime libraries), then you'll need to install the current versionVC build hook:

Download: vcbuildhooksetup. MSI (290 K)
Version4.0.2.5Uploaded2010-06-05(Supports VC 7.1, vc 8, and VC 9)

OnceVC build hookUtility is installed, it's just a matter of settingVC build hookExtended properties for your projects to use the correct build tools. As of version 4.02,VC build hookAlso sets the include and Lib system variables to the current settings for the selected version of VC, so there is no need to explicitly specify the correct paths in your project settings.

WhenVC build hookIs started, Visual Studio solutions will have two new extended properties:LowprioritybuildAndBuildtoolversion.

TheLowprioritybuildProperty is only available for solutions and can be either 'yes', 'no', or 'notset'. Currently,VC build hookMakes all builds low priority unless this property is set to 'no '. A low priority build means that other tasks will receive more processor time during a build (at the expense of build time, of course ). theBuildtoolversionProperty is available for solutions or projects, and may be set to 'vc7', 'vc8', 'vc9', or 'default '. A setting of 'default' for projects causes the solution property to be inherited. if the project and solution are both set to 'default', then the build tool paths will not be affected and Visual Studio will use the default build tools.

When using Visual Studio 2005 or later ide:

Disable parallel builds! TheVC build hookUtility does not work correctly if two simultaneous builds are using different settings, so you should disable this feature in Visual Studio Global Options. to do this, go to tools-> options, open 'projects and solutions ', select the 'build and run' tab, and change the 'maximum number of parallel project builds 'to 1. in my experience, Visual Studio is more stable when parallel builds are disabled, so there is a benefit to disabling this feature that is unrelatedVC build hook.

When using the VC 7 build tools:

Disable the manifest tool. this is easy to do, but not obvious or well known ented. right-click on a project and select 'tool build order... ', then select 'all comprehensions' in the configuration dropdown and dismiss the warning dialog, then uncheck the box beside 'manifest tool '. using the IDE, you have to do this one project at a time.

In linker settings, on the 'manifest file' tab, set 'generate manifest 'to 'no'. This disables manifest file generation.

Disable Error Reporting. in C/C ++ settings, on the 'advanced 'tab, set 'error report' to 'default '. do the same in linker settings, on the 'advanced 'tab.

Set 'treat wchar_t as built-in type' to 'no' in the C/C ++ Project Settings language section.

Don't use Unicode response files. change this in C/C ++ settings on the 'general 'tab by setting 'use Unicode response files' to 'no '. do the same in linker settings, also on the 'total' tab. theVC build hookUtility will automatically convert Unicode response files to ANSI files if they are being sent to a VC 7 build tool, so this step is not strictly required, however the build will be slightly less efficient if the files need to be converted.

If your project uses precompiled headers, there is one additional issue to deal. visual Studio 2005 removed support for the "automatically generate" (/Yx) precompiled header option. this is not a problem when using the vc 8 or later build tools, but when using the VC 7 build tools, it can make the Build Process unbearably slow. luckily it's not difficult to re-enable automatic use of precompiled headers when building with VC 7 build tools. to re-enable this feature in a project that is using the VC 7 build tools, you need to edit the 'precompiled header' tab of the C/C ++ settings. first, make sure precompiled headers are disabled ('create/use precompiled head' should be set to 'not using precompiled headers'), then set the 'precompiled header file''$(IntDir)/$(TargetName).pch'For all deployments, then go to the 'COMMAND line' tab and add'/YXStdAfx.h'To The 'additional option' field at the bottom. Voila! Precompiled headers shoshould now work just as they did when building with the Visual Studio. NET 2003 IDE.

If your project was created by a later version of the ObjectARX wizard that does not create. def file, you must add the following in one of your source files (I prefer acrxentrypoint. CPP) in order to ensure that the necessary functions get exported:

#pragma comment(linker,"/EXPORT:_acrxEntryPoint")
#pragma comment(linker,"/EXPORT:_acrxGetApiVersion")

I need to stress again that these steps only work without error after you have implemented the practices discussed here.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.