VS2005 - Undeclared Identifier (though header is included)
Sep 4, 2008 at 12:20am UTC
Hello All,
I come from a Java background, so please excuse me if this is a stupid question, but I haven't been able to work out the issue.
I'm using a plug-in for a brief application I'm writing, and I have to connect to a database.
I'm making a C++ MFC MDI application, and I'm trying to connect to the database in my child frame. I'm using the following code:
1 2 3 4 5 6 7
CChildFrame::CChildFrame()
{
// TODO: add member initialization code here
ODBCConnect pConnect;
pConnect.ConnectStr = "DSN=Students" ;
IDC_TTF11.ODBCConnectEx(pConnect, true );
}
At the top of my page I have a header file called CF1Book.h included:
1 2 3 4 5 6 7
#include "versionfour.h"
#include "ChildFrm.h"
#include "CF1Book.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
inside my CF1Book header I have the following code:
1 2 3 4 5 6 7 8 9 10 11
void ODBCConnect(BSTR * pConnect, BOOL bShowErrors, short * pRetCode)
{
static BYTE parms[] = VTS_PBSTR VTS_BOOL VTS_PI2 ;
InvokeHelper(0x10c, DISPATCH_METHOD, VT_EMPTY, NULL, parms, pConnect, bShowErrors, pRetCode);
}
void ODBCConnectEx(LPDISPATCH pConnectObj, BOOL bShowErrors)
{
static BYTE parms[] = VTS_DISPATCH VTS_BOOL ;
InvokeHelper(0x579, DISPATCH_METHOD, VT_EMPTY, NULL, parms, pConnectObj, bShowErrors);
}
When I try to run it, I get an Undeclared Identifier error for the first mention of ODBCConnect. Any ideas why? I thought if i included the header file with the information for it, that I could then call it
Sep 4, 2008 at 2:02am UTC
What's the exact error?
Sep 4, 2008 at 2:52am UTC
error C2065: 'ODBCConnect' : undeclared identifier
Topic archived. No new replies allowed.