FIX: L2029 Error Calling ODBC Functions from ODBC SDKID: Q108522
|
When building an application using the ODBC Software Development Kit (SDK), linker error L2029 "unresolved external" may occur on calls made to ODBC functions.
Several header files included with the ODBC SDK are missing extern
"C" statements, which are needed to make them compatible with a C++
compiler. The functions residing in the ODBC libraries do not have
decorated names, and therefore the extern "C" statement is necessary
if you are calling the functions from an application written in C++.
The following header files are affected by this problem:
SQL.H
SQLEXT.H
ODBCINST.H
ODBCVER.H
There are two ways to handle this problem:
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif
.
. // The body of the header file goes here.
.
#ifdef __cplusplus
}
#endif
This is the preferred way of handling this situation. This
solution will correct the problem permanently.
extern "C" {
#include <SQL.H>
#include <SQLEXT.H>
....
}
This method of working around the problem should be used on a
temporary basis only. This method will allow you to link
successfully, but each time one of these header files is included
in your program, it will need to be wrapped by an extern "C"
statement.Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. The problem was corrected in Visual C++ for Windows version 1.5 by including new versions of the four header files listed above.
Additional query words: 1.00 1.50 7.00 8.00 8.00c
Keywords : kb16bitonly kbCompiler kbCPPonly kbVC
Version : 7.00 | 1.00
Platform : MS-DOS WINDOWS
Issue type :
Last Reviewed: July 30, 1999