Note: this doc assumes that you have access to the SmartHeap
Getting Started Guide for Win32
The goal is to successfully link your application or DLL to SmartHeap.
The Getting Started Guide (GSG) gives you two different paths to
this goal:
- The "quick start" procedure described in the GSG under the heading
"Quick Start" (see the table of contents)
- A somewhat more involved procedure where you specify a SmartHeap
library in the VC++ Project/Settings/Link dialog (or the appropriate
property page in VC++ 7) . This procedure is described in the
GSG under the headings "Setting up your application for the SmartHeap
runtime library" (for release builds) and "Debugging an application
with SmartHeap" (for debug builds).
If you're reading this, then presumably one of the above procedures
didn't work for you. In that case, here's what you can do:
If you got link errors when you used the 'Quick Start' procedure,
try this
If you got link errors when you listed a SmartHeap lib on the
Link dialog Object/library modules line (Property Page in VC++ 7),
try this
If you got link errors when you used the 'Quick Start' procedure...
- Undo the changes you made to stdafx.cpp as part of the quick
start procedure.
- Open the file stdafx.h. At the top of that file, before any
#include statements, add the text
- #include<[SHFILE]>
- where [SHFILE] is the file that quick start instructed you to
#include in stdafx.cpp
- Save your changes to stdafx.h
- Choose Rebuild All from the Build menu
- Repeat the Rebuild All command for both Release and Debug project
configurations.
Note that this procedure is just 'quick start', but you're using
stdafx.h instead of stdafx.cpp. If you still get link errors, see
the next paragraph.
Linking the old fashioned way:
Quick Start is the procedure we recommend, but if it just won't
work for you then you should be able to link using the following
procedure:
- Undo any changes you made to your project (modifications to
stdafx.h, etc) to support the quick start procedure.
- Use the tables in the GSG to determine which SmartHeap lib(s)
your application should be linked to. These tables are found under
the heading "Setting up the Visual C++ project file"; there are
separate tables for runtime and debug builds.
- If you're using VC++ versions 5 or 6, open the Project/Settings/Link
dialog. At the front of the Object/library modules line, before
any other libs, list the SmartHeap libs that you want to use.
Then, still in the Link dialog, change to "Input" category. On
the Force symbol references line put these two symbols: _SmartHeap_malloc
_SmartHeap_new. If you're using MFC, and if you're trying to link
to SmartHeap 7 or later, also put _SmartHeap_mfc on the force
symbol references line.
- If you're using VC++ version 7, open the property page for your
configuration. Click the Linker folder, then the Input property
page, and add the SmartHeap libs you want to use to the front
of the Additional Dependencies property input line. On the same
Input page, add _SmartHeap_malloc to the Force symbol references
property.
- Rebuild. <Top>
If you got link errors when you listed a SmartHeap lib on the
Link dialog Object/library modules line
- Check that you have not applied to your project any of
the changes required to use the 'quick start' linking procedure
(such as modifying stdafx.cpp, adding smrtheap.c to the project,
et al)
- Check that you are linking to the correct SmartHeap lib(s) for
your configuration. Note that SmartHeap has separate libs for
debug and release builds.
- If you're using VC++ versions 5 or 6, open the Project/Settings/Link
dialog. Change to "Input" category. On the Force symbol references
line put _SmartHeap_malloc
- If you're using VC++ version 7, open the property page for your
configuration. Click the Linker folder, then the Input property
page, and add _SmartHeap_malloc to the Force symbol references
property.
- Rebuild.
If these procedures do not resolve the link error, then trying
linking using Quick Start. Before you apply Quick Start, be sure
to remove the SmartHeap lib(s) from the Link dialog's Object/library
modules line. <Top>
|