| |
Using MSVC 7.1 (Net 2003) to build AutoCAD 2000-2002 ARX applications
First let me give a big round of thanks to Owen Wengerd at Manusoft for the
tremendous effort he as put into this problem, and then for also sharing
that information with us programmers. You will need to visit his web site
and get a couple needed utilities. While there, it's essential that you
read his tutorials. What I plan to do on this page is to "fill in
the blanks" and cover items that caused me problems.
Ok, let's get started.
- Read Owen's
tutorial. Read it again.
- Environment Variables
- Set these using Windows->Control Panel->System dialog. This
is the "System Properties" dialog. Select the "Advanced" tab.
Then select the "Environment Variables" button.
- Add variables as explained in Owen's
tutorial. Be sure to
use the correct path names that point to your development tools.
For consistency with how MSVC 7.1 sets up directories I suggest
that you add the "\" (backslash) character to the end of all paths defined.
- MSVC 7.1 Global Setup
- Download and install VCBuildHookSetup.msi from Owen's site.
- Download HideDelayLoadImports.exe as well. Install as suggested.
- Download and install the latest ARX Wizard for AutoCAD 2005.
- Leave the Tools->Options->Directories information alone.
- ObjectARX Project Settings
- Start a new ObjectARX project using the ARX Wizard.
- Open the "Project Properties" dialog box, click the
"Configuration Manager" button.
- Select <New...> from the "Active Solution Configuration" list box.
- Type in a solution name in the "Solution Configuration Name"
edit box. I use "Debug ARX2000" for AutoCAD 2000 debug builds
and "Release ARX2000" for release builds.
- In the "Copy Settings From" list box select "Debug" or "Release".
- Make sure "Also create new Project Configuration(s)" is checked.
- Click the "OK" button.
- Click the "Close" button.
- You should know be back at the "Project Properties" dialog.
- In the tree view on the left select the "C/C++" branch.
- Select the "General" branch.
- Change "Additional Include Directories" to
$(MSVC6)INCLUDE;$(MSVC6)MFC\INCLUDE;$(MSVC6)ATL\INCLUDE;$(ARX2000)inc
- Change "Debug Information Format" to "Program Database (/Zi)".
- Turn off "Detect 64-bit Portability Issues". Otherwise you'll
get hundreds of warning when using MFC.
- Select the "Preprocessor" branch.
- In "Preprocessor Definitions" I like to add "ARX2000" for
conditional compiling using #ifdef, #ifndef, etc… (note that this
is a preprocessor definition and not the environment variable
created in step 2).
- In the tree view select "Code Generation".
- Set "Basic Runtime Checks" to "Default".
- Set "Buffer Security Check" to "No".
- In the tree view select the "Linker" branch.
- Select the "General" branch.
- Change "Additional Library Directories" to
$(MSVC6)LIB;$(MSVC6)MFC\LIB;$(ARX2000)lib
- Select the "Input" branch.
- Add all needed dependencies to "Additional Dependencies".
Here's what I've added right off (more can be added later as
required by your project):
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib rxapi.lib acrx15.lib acdb15.lib acutil15.lib acge15.lib acgiapi.lib achapi15.lib acISMobj15.lib acad.lib acedapi.lib acsiobj.lib acui15.lib
- In the tree view select the "Resources" branch.
- Select the "General" branch.
- Change "Additional Include Directories" to
$(MSVC6)INCLUDE;$(MSVC6)MFC\INCLUDE
- In the tree view Select the "Build Events" branch.
- Select the "Post-Build Event" branch.
- Change "Command Line" to Add HideDelayLoadImports.exe
"$(TargetPath)"
- Click the "Ok" button to have settings updated and the dialog
box dismissed.
- You should now be somewhere in your IDE. Bring up the
"Solutions Explorer" window.
- In the "Solutions Explore" tree view select your project,
not the solution. You should now have a "Properties" window
and the name of the project select is displayed. Change
"Use VC7 Paths" to "Yes" (note: this property is added via
the VCBuildHookSetup add-in).
- Build your project.
- If this is the first time you've tried building an
ObjectARX 2000-2002 project with MSVC 7.1 then you'll
get a few compiler errors and warnings. For example:
c:\VSNet Projects\Testing\StdAfx.h(121): error C2143:
syntax error : missing ';' before '<'
- These errors are from the code generated with the
ARX Wizard for AutoCAD 2005. The quick and dirty fix
is to copy three files found in the include directory
of ObjectARX 2004/2005 into the ObjectARX 2000-2002
include directory. The files are acapdmgr.h, arxentrypoint.h,
and dbxentrypoint.h.
- In StdAfx.h
- Comment out the line that says #include "arxHeaders.h"
- In StdAfx.h right below the #include "DocData.h" line,
add:
#include "accmd.h"
#include "AcExtensionModule.h"
#include "acapdmgr.h"
#include "arxentrypoint.h"
- If you told the ARX Wizard that this project was an MFC
Extension application then you will need to include the
following files as well.
#include "AcExtensionModule.h"
#include "adui.h"
#include "acui.h"
#include "aduiBaseDialog.h"
#include "aduiButton.h"
#include "aduiComboBox.h"
#include "aduiDialog.h"
#include "aduiDialogBar.h"
#include "aduiDock.h"
#include "aduiEdit.h"
#include "aduiFileDialog.h"
#include "aduiHeaderCtrl.h"
#include "aduiListBox.h"
#include "aduiListCtrl.h"
#include "aduiMessage.h"
#include "aduiRegistryAccess.h"
#include "aduiTabChildDialog.h"
#include "aduiTabCtrl.h"
#include "aduiTabExtension.h"
#include "aduiTabMainDialog.h"
#include "aduiTextTip.h"
- Rebuild your project. It should compile without errors.
Hurray, now test it in AutoCAD 2000-2002.
- Well that's cool, but steps in 6-B sure seems like a lot of work
for every project we create. Plus, we'll probably loose some of the
ARX Wizards code generation capabilities. What to do? The clue is
in step 6-B-a. arxHeaders.h is a pretty cool file (found in the
ObjectARX 2004/2005 include directory). What we need is to copy
this file to our ObjectARX 2000-2002 include directory (also get
dbxHeaders.h). These 2 files will need heavy editing to remove
all references to headers and libraries that are not available
in the ARX version your compiling for. I leave it to you as an
exercise to do these modifications yourself. Once this step is
taken care of then all of step 6-B can be eliminated, the ARX libraries from
step 4-F-b can be removed. Now the
wizard generated code should compile as created (there are
exceptions and that's what the use of preprocessors such as
ARX2000 is for).
Misc Tips:
- If your getting error LNK2019: unresolved external symbol
__RTC_CheckEsp referenced in function _$E1 as a compiler error
then make sure you've performed steps 4-E-c. If your still getting
this error then you've probably imported a MSVC6 project into MSVC7.1.
You'll need to open the "*.vcproj" file in NOTEPAD, and change all
occurrences of BasicRuntimeChecks="3" to BasicRuntimeChecks="0".
WARNING: Only, change the BasicRuntimeChecks pertaining to your
ObjectARX 2000-2002 project properties. Since this file is in XML
format its fairly easy to understand.
- If your getting a lot of template errors when compiling, then
make sure you've done step 5.
- Add the code on Owen's web site if your getting
error LNK2001:
unresolved external symbol __ftol2
| |
|