Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 102697 - Last Review: December 9, 2005 - Revision: 5.1
An attempt to create a debugging library that uses precompiled headers may fail, and fatal build errors may be generated
This article was previously published under Q102697
An attempt to create a debugging library that uses
precompiled headers may fail and fatal build errors may be generated. With the
16-bit edition, the CVPACK and LINK utilities may generate the following error
message:
CVPACK : fatal error CK1017: cannot find
precompiled types file; relink with file.obj
LINK : warning LNK4027:
CVPACK error
With the 32-bit edition, the LINK utility may generate
the following error message:
LINK : fatal error LNK1211:
precompiled type information not found; "<filename>" not linked or
overwritten
Note If you build a static library in a Visual Studio .NET version
with precompiled header file, and you use the compiler debug switches /ZI or
/Zi, you may not receive the errors that are listed in this article, but you
may see either of the following two problems while debugging your application
and trying to view any variables from the library in the Watch window:
- You may receive the following error message in the Watch
window:
CXX0033:Error:error in OMF type
information
- While expanding a class object, you may see only blank
entries for the class members.
The resolution for this debugging problem is the same as is
described in the "Resolution" section of this article.
When you specify the
/Yc and
/Z7 options on the compiler command line, Microsoft C/C++ generates a
precompiled header file that contains CodeView debugging information. The error
occurs only when you store the precompiled header in a library, use the library
to build an object module, and the source code does not refer to any of the
functions the precompiled header file defines.
There are two methods to work around this situation, as
follows:
- Specify the /Yd compiler option switch to add the CodeView information from the
precompiled header to each object module. This method is less desirable because
it generally produces large object modules that can increase the time required
to link the application.
- Note The following work-around is for 32-bit versions only. Specify
the /Yl<symbol> compiler option switch, where <symbol> is the name of an arbitrary symbol in the library, when you
create a precompiled header file that does not contain any function
definitions. This switch directs the compiler to store the debugging
information in the precompiled header file.
This behavior is by design.
When you compile a module with the
/Yc and
/Yl<symbol_name> option switches using the 32-bit edition, the compiler creates a
symbol similar to __@@_PchSym_@00@...@<symbol_name>, where the ellipsis
(...) represents a linker generated character string, and stores it in the
object module. Any source file that you compile with this precompiled header
refers to the specified symbol, which causes the linker to include the object
module and its debugging information from the library.
The following
code example demonstrates the problem.
Sample code
/*
* To demonstrate this problem, perform the following five steps:
*
* 1. Compile TEST1.C as follows: cl /Yctest.h /Z7 /c TEST1.C
* 2. Compile TEST2.C as follows: cl /Yutest.h /Z7 /c TEST2.C
* 3. Build a library that contains TEST1.OBJ and TEST2.OBJ as
* follows: lib /out:test.lib test1.obj test2.obj
* 4. Compile TEST3.C as follows: cl /Yutest.h /Z7 /c TEST3.C
* 5. Link the application as follows:
* link /debugtype:cv /debug:notmapped,full test3.obj test.lib
*
* To correct this problem, do one of the following:
*
* 1. 32-bit only) Compile TEST1.C in step 1 as follows:
* cl /Yctest.h /YlAnyName /Z7 /c TEST1.C
* Then, repeat step 2 through 5.
*
* 2. Repeat steps 1 through 5, adding the /Yd command line option
* to steps 1, 2, and 4.
*/
TEST.H
TEST1.C
TEST2.C
#include "test.h"
void test2func(void)
{
printf("inside TEST2FUNC...\n");
}
TEST3.C
#include "test.h"
void test2func(void);
void main(void)
{
printf("inside MAIN...\n");
}
APPLIES TO
- Microsoft Visual C++ 1.0 Professional Edition
- Microsoft Visual C++ 1.5 Professional Edition
- Microsoft Visual C++ 1.51
- Microsoft Visual C++ 1.52 Professional Edition
- Microsoft Visual C++ 2.0 Professional Edition
- Microsoft Visual C++ 2.1
- Microsoft Visual C++ 2.2
- Microsoft Visual C++ 4.1 Subscription
- Microsoft Visual C++ 5.0 Enterprise Edition
- Microsoft Visual C++ 6.0 Enterprise Edition
- Microsoft Visual C++ 5.0 Professional Edition
- Microsoft Visual C++ 6.0 Professional Edition
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++ .NET 2003 Standard Edition
- Microsoft Visual C++ .NET 2002 Standard Edition
- Microsoft Visual C++ 2005 Express Edition
| kberrmsg kbtshoot kbprb kbcompiler KB102697 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please