9***@gmail.com
2007-10-24 21:49:30 UTC
Hello there,
I'm trying to write my first Embedded SQL C++ program but am hung up with 6 instances of the following error:
"cpp.sqx(29) : error C2275: 'sqlca' : illegal use of this type as an expression c:\program files\ibm\sqllib\include\sqlca.h(40) : see declaration of 'sqlca'"
What I'm getting from that error message is that the Visual C++ 2005 Express compiler that I'm using doesn't like the way that DB2 prepped my .sqx into a .cxx.
Here's my .sqx:
----------------------------------------------
#include <sqlenv.h>
#include <sqlutil.h>
#include "utilemb.h"
#if ((__cplusplus >= 199711L) && !defined DB2HP && !defined DB2AIX) || \
(DB2LINUX && (__LP64__ || (__GNUC__ >= 3)) )
#include <iomanip>
#include <iostream>
using namespace std;
#else
#include <iomanip.h>
#include <iostream.h>
using namespace std;
#endif
EXEC SQL BEGIN DECLARE SECTION;
char dbName[10];
char dbUser[20];
char dbPswd[40];
char currentDate[50];
EXEC SQL END DECLARE SECTION;
extern "c" __declspec(dllexport)
void jonoGetChar(char* db, char* user, char* pswd, char* out_date)
{
sprintf(dbName, "%s", db);
sprintf(dbUser, "%s", user);
sprintf(dbPswd, "%s", pswd);
EXEC SQL CONNECT TO :dbName USER :dbUser USING :dbPswd;
EXEC SQL SELECT CURRENT DATE INTO :currentDate FROM MYTABLE WHERE FLAG = '1';
EXEC SQL CONNECT RESET;
sprintf(out_date, "%s", currentDate);
}
int main(int argc, char *argv[])
{
int rc = 0;
return rc;
}
-------------------------------------------------------------------
First I connect to my database and then run
"db2 prep cpp.sqx"
I then disconnect from my database and run
"cl -Zi -Od -c -W2 -LD -DWIN32 /EHsc cpp.cxx utilemb.cxx"
When that runs I get all those errors complaining about 'sqlca'.
Any ideas why that's not working?
Thanks!
I'm trying to write my first Embedded SQL C++ program but am hung up with 6 instances of the following error:
"cpp.sqx(29) : error C2275: 'sqlca' : illegal use of this type as an expression c:\program files\ibm\sqllib\include\sqlca.h(40) : see declaration of 'sqlca'"
What I'm getting from that error message is that the Visual C++ 2005 Express compiler that I'm using doesn't like the way that DB2 prepped my .sqx into a .cxx.
Here's my .sqx:
----------------------------------------------
#include <sqlenv.h>
#include <sqlutil.h>
#include "utilemb.h"
#if ((__cplusplus >= 199711L) && !defined DB2HP && !defined DB2AIX) || \
(DB2LINUX && (__LP64__ || (__GNUC__ >= 3)) )
#include <iomanip>
#include <iostream>
using namespace std;
#else
#include <iomanip.h>
#include <iostream.h>
using namespace std;
#endif
EXEC SQL BEGIN DECLARE SECTION;
char dbName[10];
char dbUser[20];
char dbPswd[40];
char currentDate[50];
EXEC SQL END DECLARE SECTION;
extern "c" __declspec(dllexport)
void jonoGetChar(char* db, char* user, char* pswd, char* out_date)
{
sprintf(dbName, "%s", db);
sprintf(dbUser, "%s", user);
sprintf(dbPswd, "%s", pswd);
EXEC SQL CONNECT TO :dbName USER :dbUser USING :dbPswd;
EXEC SQL SELECT CURRENT DATE INTO :currentDate FROM MYTABLE WHERE FLAG = '1';
EXEC SQL CONNECT RESET;
sprintf(out_date, "%s", currentDate);
}
int main(int argc, char *argv[])
{
int rc = 0;
return rc;
}
-------------------------------------------------------------------
First I connect to my database and then run
"db2 prep cpp.sqx"
I then disconnect from my database and run
"cl -Zi -Od -c -W2 -LD -DWIN32 /EHsc cpp.cxx utilemb.cxx"
When that runs I get all those errors complaining about 'sqlca'.
Any ideas why that's not working?
Thanks!