Narusegawa
asked on
C++ & Databases
At the moment I use Delphi and have been for the past 3 years, however I'm trying to get into C++ and write cross-platform code without relying on IDE's and platform-specific API/Drivers.
In Delphi I use something like:
ADOConnection.Close;
ADOConnection.ConnectionSt ring := 'Provider=SQLOLEDB.1;Passw ord=passwo rd;User ID=scheme;Data Source=tech06;Initial Catalog=demo';
ADOConnection.Connect;
ADOQuery.Connection := ADOConnection;
ADOQuery.Close;
ADOQuery.SQL.Text := "select * from scheme.slcustm";
ADOQuery.Open;
while not ADODatasource_Cust.Dataset .EOF do
begin
ShowMessage(ADODatasource_ Cust.Datas et.FieldBy Name('acco untid').As String);
ADODatasource_Cust.Dataset .Next;
end
That example isn't very real-world but illustrates how to just grab a dataset, and iterate through it. The syntax is very similar for Oracle/MySQL too. I wanted to find a solution that would allow something just as easy/rapid in C++.
Any suggestions? I'm already looking at SourcePro from RogueWave. But as I'm a single developer learning C++ in my own time on my own budget I don't really have the funds for commercial products.
In Delphi I use something like:
ADOConnection.Close;
ADOConnection.ConnectionSt
ADOConnection.Connect;
ADOQuery.Connection := ADOConnection;
ADOQuery.Close;
ADOQuery.SQL.Text := "select * from scheme.slcustm";
ADOQuery.Open;
while not ADODatasource_Cust.Dataset
begin
ShowMessage(ADODatasource_
ADODatasource_Cust.Dataset
end
That example isn't very real-world but illustrates how to just grab a dataset, and iterate through it. The syntax is very similar for Oracle/MySQL too. I wanted to find a solution that would allow something just as easy/rapid in C++.
Any suggestions? I'm already looking at SourcePro from RogueWave. But as I'm a single developer learning C++ in my own time on my own budget I don't really have the funds for commercial products.
You can download the client library distribution from Oracle/MySql websites. The development environment for oracle is called Pro*C. Its is a little bit different than normal C++ because you can write SQL statements inside your C++ program. Then Orcale Pro*C (which is actually a precompiler) converts your code to a pure C++ code substituting the Sqllib library calls in place of the SQL statements. You can then compile it using normal C++ compiler and link it with the sqllib library. This will solve your purpose.
In case of MySql, this is fairly easy. You can download the client library which contains all the compiled functions required for your transactions ( e.g mysql_connect(), mysql_query() and mysql_close() ). You can simply include the header files which has the declarations for those functions and just link it with the library provided with. This will create the executable and you can do whatever you want to do with the MySql database.
Cheer!!!
In case of MySql, this is fairly easy. You can download the client library which contains all the compiled functions required for your transactions ( e.g mysql_connect(), mysql_query() and mysql_close() ). You can simply include the header files which has the declarations for those functions and just link it with the library provided with. This will create the executable and you can do whatever you want to do with the MySql database.
Cheer!!!
ASKER
gseidman: That's a great explanation. I was looking at ODBC but being new to C++ I have started to do much with Classes yet. You 'simple code' would be great for helping me get a start on it. I'm not sure how ODBC differentiates between what drivers it loads. i.e. You tell it MSSQL and it finds the driver? You tell it mySQL and it finds it's relevant driver. I do know that FreeTDS for Linux can talk to MSSQL, I've got that working from within a PHP site. It'd be nice to be able to use a single code base to support as many databases as I can.
The only reason I even need MSSQL as part of what I want to be able to do is that 80% of our customers run Sage on SQL 2000 servers. So to make it worthwhile for my boss to consider any C++ development in addition to Delphi I need to be able to connect to that aswell, but without too many changes in the code (which takes up 'chargable' time).
I figure from all of this that ODBC really is the best way, and ODBC is implemented in Windows by default, and with unixODBC and iODBC for Linux.
The only reason I even need MSSQL as part of what I want to be able to do is that 80% of our customers run Sage on SQL 2000 servers. So to make it worthwhile for my boss to consider any C++ development in addition to Delphi I need to be able to connect to that aswell, but without too many changes in the code (which takes up 'chargable' time).
I figure from all of this that ODBC really is the best way, and ODBC is implemented in Windows by default, and with unixODBC and iODBC for Linux.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks ever so much, that'd be most useful! I avoid database specific commands when I can anyway. If something is awkard to do I return it to the program and do it locally rather than on the database.
Okay, here's the odbcutil library I wrote. It's pretty rudimentary, but it should help you get started. You will still need to learn some of the basic ODBC API (particularly the SQLBindCol() and SQLBindParameter() functions), but the really annoying stuff about setting up and cleaning up is layered away. Note that the odbcutil.[CH] files are really just C, but DBstatement is C++. In my next comment I will include a small sample program that uses this library.
//odbcutil.H
#ifndef ODBCUTIL_H
#define ODBCUTIL_H
#include <sqltypes.h>
#include <sqlext.h>
#include <sql.h>
void closeConnection(SQLHDBC dbchandle);
void cleanup(SQLHDBC dbchandle, SQLHENV odbcenv);
void diagErrorDB(SQLHDBC dbchandle);
void diagErrorStmt(SQLHANDLE stmthandle);
void diagErrorAndExit(SQLHDBC dbchandle, SQLHENV odbcenv);
SQLRETURN allocConn(SQLHENV odbcenv, SQLHDBC *dbchandle);
SQLRETURN allocEnvAndConn(SQLHENV *odbcenv, SQLHDBC *dbchandle);
#endif //ODBCUTIL_H
//odbcutil.C
#include <stdio.h>
#include <stdlib.h>
#include <sqltypes.h>
#include <sqlext.h>
#include <sql.h>
#include "odbcutil.H"
void
closeConnection(SQLHDBC dbchandle) {
SQLDisconnect(dbchandle);
SQLFreeHandle(SQL_HANDLE_D BC, dbchandle);
}
void
cleanup(SQLHDBC dbchandle, SQLHENV odbcenv) {
closeConnection(dbchandle) ;
SQLFreeHandle(SQL_HANDLE_E NV, odbcenv);
}
void
diagErrorDB(SQLHDBC dbchandle) {
SQLCHAR status[10];
SQLINTEGER errorcode;
SQLSMALLINT msglen;
SQLCHAR errormsg[200];
SQLGetDiagRec(SQL_HANDLE_D BC, dbchandle, 1,
status, &errorcode, errormsg, 100, &msglen);
printf("[%s] %s (%d)\n", status, errormsg, errorcode);
}
void
diagErrorStmt(SQLHANDLE stmthandle) {
SQLCHAR status[10];
SQLINTEGER errorcode;
SQLSMALLINT msglen;
SQLCHAR errormsg[200];
SQLGetDiagRec(SQL_HANDLE_S TMT, stmthandle, 1,
status, &errorcode, errormsg, 100, &msglen);
printf("[%s] %s (%d)\n", status, errormsg, errorcode);
}
void
diagErrorAndExit(SQLHDBC dbchandle, SQLHENV odbcenv) {
diagErrorDB(dbchandle);
cleanup(dbchandle, odbcenv);
exit(1);
}
/* returns SQL_SUCCESS on success, retcode on fail */
SQLRETURN
allocConn(SQLHENV odbcenv, SQLHDBC *dbchandle) {
// 2. allocate connection handle, set timeout
SQLRETURN retcode = SQLAllocHandle(SQL_HANDLE_ DBC, odbcenv, dbchandle);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
printf("Error AllocHDB %d\n", retcode);
return retcode;
}
SQLSetConnectAttr(*dbchand le, SQL_LOGIN_TIMEOUT, (SQLPOINTER *)5, 0);
}
/* returns SQL_SUCCESS on success, retcode on fail */
SQLRETURN
allocEnvAndConn(SQLHENV *odbcenv, SQLHDBC *dbchandle) {
SQLRETURN retcode; // result of functions
// 1. allocate Environment handle and register version
retcode=SQLAllocHandle(SQL _HANDLE_EN V, SQL_NULL_HANDLE, odbcenv);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
printf("Error AllocHandle\n");
return retcode;
}
retcode =
SQLSetEnvAttr(*odbcenv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
printf("Error SetEnv\n");
SQLFreeHandle(SQL_HANDLE_E NV, *odbcenv);
return retcode;
}
// 2. allocate connection handle, set timeout
retcode = allocConn(*odbcenv, dbchandle);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
SQLFreeHandle(SQL_HANDLE_E NV, *odbcenv);
return retcode;
}
SQLSetConnectAttr(*dbchand le, SQL_LOGIN_TIMEOUT, (SQLPOINTER *)5, 0);
return SQL_SUCCESS;
}
//dbstatement.H
#ifndef DBSTATEMENT_H
#define DBSTATEMENT_H
#include <sqltypes.h>
#include <sqlext.h>
#include <sql.h>
#include <stdio.h>
class DBstatement {
private:
const bool owner;
protected:
SQLHANDLE stmthandle; // statement handle
SQLHDBC dbchandle; // DB handle, need it to be handy
SQLINTEGER NTSp;
DBstatement(SQLHDBC DBChandle, const char *stmt,
bool ownconnection = false);
DBstatement(SQLHDBC DBChandle,
bool ownconnection = false);
inline SQLRETURN exec() { return SQLExecute(stmthandle); }
SQLRETURN exec(SQLCHAR *stmt);
public:
bool diag(SQLRETURN retcode);
virtual ~DBstatement();
};
#endif //DBSTATEMENT_H
//dbstatement.C
#ifndef NDEBUG
#include <iostream>
#endif
#include <sqltypes.h>
#include <sqlext.h>
#include <sql.h>
#include <stdlib.h>
#include <stdio.h>
#include "odbcutil.H"
#include "dbstatement.H"
DBstatement::DBstatement(S QLHDBC DBChandle, const char *stmt,
bool ownconnection) :
dbchandle(DBChandle), owner(ownconnection),
NTSp(SQL_NTS) {
SQLRETURN retcode; // result of functions
retcode = SQLAllocHandle(SQL_HANDLE_ STMT, DBChandle, &stmthandle);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
exit(1);
}
retcode = SQLPrepare(stmthandle, (SQLCHAR *)stmt, SQL_NTS);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
exit(1);
}
}
DBstatement::DBstatement(S QLHDBC DBChandle, bool ownconnection) :
dbchandle(DBChandle), owner(ownconnection),
NTSp(SQL_NTS) {
SQLRETURN retcode; // result of functions
retcode = SQLAllocHandle(SQL_HANDLE_ STMT, DBChandle, &stmthandle);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
exit(1);
}
}
DBstatement::~DBstatement( ) {
SQLFreeHandle(SQL_HANDLE_S TMT, stmthandle);
if (owner)
closeConnection(dbchandle) ;
}
SQLRETURN
DBstatement::exec(SQLCHAR *stmt) {
#ifndef NDEBUG
std::cerr << "Executing SQL: " << stmt << std::endl;
#endif
return SQLExecDirect(stmthandle, stmt, SQL_NTS);
}
bool
DBstatement::diag(SQLRETUR N retcode) {
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
//diagErrorDB(dbchandle);
diagErrorStmt(stmthandle);
//SQLCancel(stmthandle);
return true;
} else {
//printf("No error.\n");
return false;
}
}
//odbcutil.H
#ifndef ODBCUTIL_H
#define ODBCUTIL_H
#include <sqltypes.h>
#include <sqlext.h>
#include <sql.h>
void closeConnection(SQLHDBC dbchandle);
void cleanup(SQLHDBC dbchandle, SQLHENV odbcenv);
void diagErrorDB(SQLHDBC dbchandle);
void diagErrorStmt(SQLHANDLE stmthandle);
void diagErrorAndExit(SQLHDBC dbchandle, SQLHENV odbcenv);
SQLRETURN allocConn(SQLHENV odbcenv, SQLHDBC *dbchandle);
SQLRETURN allocEnvAndConn(SQLHENV *odbcenv, SQLHDBC *dbchandle);
#endif //ODBCUTIL_H
//odbcutil.C
#include <stdio.h>
#include <stdlib.h>
#include <sqltypes.h>
#include <sqlext.h>
#include <sql.h>
#include "odbcutil.H"
void
closeConnection(SQLHDBC dbchandle) {
SQLDisconnect(dbchandle);
SQLFreeHandle(SQL_HANDLE_D
}
void
cleanup(SQLHDBC dbchandle, SQLHENV odbcenv) {
closeConnection(dbchandle)
SQLFreeHandle(SQL_HANDLE_E
}
void
diagErrorDB(SQLHDBC dbchandle) {
SQLCHAR status[10];
SQLINTEGER errorcode;
SQLSMALLINT msglen;
SQLCHAR errormsg[200];
SQLGetDiagRec(SQL_HANDLE_D
status, &errorcode, errormsg, 100, &msglen);
printf("[%s] %s (%d)\n", status, errormsg, errorcode);
}
void
diagErrorStmt(SQLHANDLE stmthandle) {
SQLCHAR status[10];
SQLINTEGER errorcode;
SQLSMALLINT msglen;
SQLCHAR errormsg[200];
SQLGetDiagRec(SQL_HANDLE_S
status, &errorcode, errormsg, 100, &msglen);
printf("[%s] %s (%d)\n", status, errormsg, errorcode);
}
void
diagErrorAndExit(SQLHDBC dbchandle, SQLHENV odbcenv) {
diagErrorDB(dbchandle);
cleanup(dbchandle, odbcenv);
exit(1);
}
/* returns SQL_SUCCESS on success, retcode on fail */
SQLRETURN
allocConn(SQLHENV odbcenv, SQLHDBC *dbchandle) {
// 2. allocate connection handle, set timeout
SQLRETURN retcode = SQLAllocHandle(SQL_HANDLE_
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
printf("Error AllocHDB %d\n", retcode);
return retcode;
}
SQLSetConnectAttr(*dbchand
}
/* returns SQL_SUCCESS on success, retcode on fail */
SQLRETURN
allocEnvAndConn(SQLHENV *odbcenv, SQLHDBC *dbchandle) {
SQLRETURN retcode; // result of functions
// 1. allocate Environment handle and register version
retcode=SQLAllocHandle(SQL
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
printf("Error AllocHandle\n");
return retcode;
}
retcode =
SQLSetEnvAttr(*odbcenv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
printf("Error SetEnv\n");
SQLFreeHandle(SQL_HANDLE_E
return retcode;
}
// 2. allocate connection handle, set timeout
retcode = allocConn(*odbcenv, dbchandle);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
SQLFreeHandle(SQL_HANDLE_E
return retcode;
}
SQLSetConnectAttr(*dbchand
return SQL_SUCCESS;
}
//dbstatement.H
#ifndef DBSTATEMENT_H
#define DBSTATEMENT_H
#include <sqltypes.h>
#include <sqlext.h>
#include <sql.h>
#include <stdio.h>
class DBstatement {
private:
const bool owner;
protected:
SQLHANDLE stmthandle; // statement handle
SQLHDBC dbchandle; // DB handle, need it to be handy
SQLINTEGER NTSp;
DBstatement(SQLHDBC DBChandle, const char *stmt,
bool ownconnection = false);
DBstatement(SQLHDBC DBChandle,
bool ownconnection = false);
inline SQLRETURN exec() { return SQLExecute(stmthandle); }
SQLRETURN exec(SQLCHAR *stmt);
public:
bool diag(SQLRETURN retcode);
virtual ~DBstatement();
};
#endif //DBSTATEMENT_H
//dbstatement.C
#ifndef NDEBUG
#include <iostream>
#endif
#include <sqltypes.h>
#include <sqlext.h>
#include <sql.h>
#include <stdlib.h>
#include <stdio.h>
#include "odbcutil.H"
#include "dbstatement.H"
DBstatement::DBstatement(S
bool ownconnection) :
dbchandle(DBChandle), owner(ownconnection),
NTSp(SQL_NTS) {
SQLRETURN retcode; // result of functions
retcode = SQLAllocHandle(SQL_HANDLE_
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
exit(1);
}
retcode = SQLPrepare(stmthandle, (SQLCHAR *)stmt, SQL_NTS);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
exit(1);
}
}
DBstatement::DBstatement(S
dbchandle(DBChandle), owner(ownconnection),
NTSp(SQL_NTS) {
SQLRETURN retcode; // result of functions
retcode = SQLAllocHandle(SQL_HANDLE_
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
exit(1);
}
}
DBstatement::~DBstatement(
SQLFreeHandle(SQL_HANDLE_S
if (owner)
closeConnection(dbchandle)
}
SQLRETURN
DBstatement::exec(SQLCHAR *stmt) {
#ifndef NDEBUG
std::cerr << "Executing SQL: " << stmt << std::endl;
#endif
return SQLExecDirect(stmthandle, stmt, SQL_NTS);
}
bool
DBstatement::diag(SQLRETUR
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
//diagErrorDB(dbchandle);
diagErrorStmt(stmthandle);
//SQLCancel(stmthandle);
return true;
} else {
//printf("No error.\n");
return false;
}
}
Here is the example program, as promised:
//getcount.H
#ifndef GETCOUNT_H
#define GETCOUNT_H
#include "dbstatement.H"
#include <sqltypes.h>
class GetCount : public DBstatement {
private:
static const char *stmt;
SQLINTEGER errorcode, num;
public:
GetCount(SQLHDBC dbchandle);
int count(const char *table);
};
#endif //GETCOUNT_H
//getcount.C
#include <string>
#include "getcount.H"
const char *GetCount::stmt = "SELECT COUNT(*) FROM ";
GetCount::GetCount(SQLHDBC dbchandle) : DBstatement(dbchandle) {
SQLBindCol(stmthandle, 1, SQL_C_ULONG, &num, 150, &errorcode);
}
int
GetCount::count(const char *table) {
SQLRETURN retcode;
std::string st(stmt);
st += table;
retcode = exec((SQLCHAR*)st.c_str()) ;
if (diag(retcode)) {
printf("While attempting to count %s.\n", table);
return -1;
} else {
SQLINTEGER nrows;
SQLSMALLINT ncols;
retcode = SQLNumResultCols(stmthandl e, &ncols);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
fprintf(stderr, "Error in NumResultCols %d\n", retcode);
SQLCancel(stmthandle);
return -1;
}
if (ncols!=1) {
fprintf(stderr, "Number of Columns %d\n", ncols);
SQLCancel(stmthandle);
return -1;
}
retcode = SQLRowCount(stmthandle, &nrows);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
fprintf(stderr, "Error in RowCount %d\n", retcode);
SQLCancel(stmthandle);
return -1;
}
if (nrows!=1) {
fprintf(stderr, "Number of Rows %d\n", nrows);
SQLCancel(stmthandle);
return -1;
}
if ((retcode=SQLFetch(stmthan dle)) != SQL_NO_DATA) {
return num;
} else {
fprintf(stderr, "No data?!?\n");
SQLCancel(stmthandle);
return -1;
}
}
}
//main.C
#include "odbcutil.H"
#include "getcount.H"
#include <stdio.h>
#include <math.h>
int
main(int argc, char **argv) {
SQLHENV odbcenv; // ODBC environment handle
SQLHDBC dbchandle; // connection handle
SQLRETURN retcode; // result of functions
SQLINTEGER nrows;
SQLSMALLINT ncols;
GetCount *cnt;
if (argc!=2) {
fprintf(stderr, "Usage: %s <tablename>\n", argv[0]);
return 1;
}
retcode = allocEnvAndConn(&odbcenv, &dbchandle);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
fprintf(stderr, "ODBC init failed\n");
return 1;
}
retcode = SQLConnect(dbchandle,
(SQLCHAR*)"DSN", SQL_NTS,
(SQLCHAR*)"username", SQL_NTS,
(SQLCHAR*)"password", SQL_NTS);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
fprintf(stderr, "ODBC connect failed\n");
return 1;
}
cnt = new GetCount(dbchandle);
printf("Table %s has %d rows.\n", argv[1], cnt->count(argv[1]));
delete cnt;
cleanup(dbchandle, odbcenv);
}
//getcount.H
#ifndef GETCOUNT_H
#define GETCOUNT_H
#include "dbstatement.H"
#include <sqltypes.h>
class GetCount : public DBstatement {
private:
static const char *stmt;
SQLINTEGER errorcode, num;
public:
GetCount(SQLHDBC dbchandle);
int count(const char *table);
};
#endif //GETCOUNT_H
//getcount.C
#include <string>
#include "getcount.H"
const char *GetCount::stmt = "SELECT COUNT(*) FROM ";
GetCount::GetCount(SQLHDBC
SQLBindCol(stmthandle, 1, SQL_C_ULONG, &num, 150, &errorcode);
}
int
GetCount::count(const char *table) {
SQLRETURN retcode;
std::string st(stmt);
st += table;
retcode = exec((SQLCHAR*)st.c_str())
if (diag(retcode)) {
printf("While attempting to count %s.\n", table);
return -1;
} else {
SQLINTEGER nrows;
SQLSMALLINT ncols;
retcode = SQLNumResultCols(stmthandl
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
fprintf(stderr, "Error in NumResultCols %d\n", retcode);
SQLCancel(stmthandle);
return -1;
}
if (ncols!=1) {
fprintf(stderr, "Number of Columns %d\n", ncols);
SQLCancel(stmthandle);
return -1;
}
retcode = SQLRowCount(stmthandle, &nrows);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
fprintf(stderr, "Error in RowCount %d\n", retcode);
SQLCancel(stmthandle);
return -1;
}
if (nrows!=1) {
fprintf(stderr, "Number of Rows %d\n", nrows);
SQLCancel(stmthandle);
return -1;
}
if ((retcode=SQLFetch(stmthan
return num;
} else {
fprintf(stderr, "No data?!?\n");
SQLCancel(stmthandle);
return -1;
}
}
}
//main.C
#include "odbcutil.H"
#include "getcount.H"
#include <stdio.h>
#include <math.h>
int
main(int argc, char **argv) {
SQLHENV odbcenv; // ODBC environment handle
SQLHDBC dbchandle; // connection handle
SQLRETURN retcode; // result of functions
SQLINTEGER nrows;
SQLSMALLINT ncols;
GetCount *cnt;
if (argc!=2) {
fprintf(stderr, "Usage: %s <tablename>\n", argv[0]);
return 1;
}
retcode = allocEnvAndConn(&odbcenv, &dbchandle);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
fprintf(stderr, "ODBC init failed\n");
return 1;
}
retcode = SQLConnect(dbchandle,
(SQLCHAR*)"DSN", SQL_NTS,
(SQLCHAR*)"username", SQL_NTS,
(SQLCHAR*)"password", SQL_NTS);
if ((retcode != SQL_SUCCESS) && (retcode != SQL_SUCCESS_WITH_INFO)) {
fprintf(stderr, "ODBC connect failed\n");
return 1;
}
cnt = new GetCount(dbchandle);
printf("Table %s has %d rows.\n", argv[1], cnt->count(argv[1]));
delete cnt;
cleanup(dbchandle, odbcenv);
}
ASKER
Using Dev-C++ I get the following when trying to compile main.c after adding it (and all the other files) to a new project.
Compiler: Default compiler
Building Makefile: "D:\C++\ODBCTest\Makefile. win"
Executing make...
make.exe -f "D:\C++\ODBCTest\Makefile. win" all
g++.exe -c main.c -o main.o -I"C:/GTK/INCLUDE" -I"C:/GTK/INCLUDE/GTK-2.0" -I"C:/GTK/INCLUDE/GLIB-2.0 " -I"C:/GTK/INCLUDE/PANGO-1. 0" -I"C:/GTK/INCLUDE/ATK-1.0" -I"C:/GTK/INCLUDE/GTKGLEXT -1.0" -I"C:/GTK/LIB/GTK-2.0/INCL UDE" -I"C:/GTK/LIB/GLIB-2.0/INC LUDE" -I"C:/GTK/LIB/GTKGLEXT-1.0 /INCLUDE" -I"C:/GTK/INCLUDE/LIBGLADE -2.0" -I"C:/GTK/INCLUDE/LIBXML2" -I"C:/Program Files/Dev-Cpp/include/c++" -I"C:/Program Files/Dev-Cpp/include/c++/ mingw32" -I"C:/Program Files/Dev-Cpp/include/c++/ backward" -I"C:/Program Files/Dev-Cpp/include" -I"D:/C++/ODBCTest"
In file included from odbcutil.H:3,
from main.c:1:
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:17: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:18: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:24: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:25: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:26: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:27: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:29: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:34: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:36: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:37: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:50: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:51: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:71: error: syntax error before `;'
token
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:90: error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:91: error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:94: error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:95: error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:96: error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:100 : error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:101 : error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:102 : error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:103 : error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:104 : error: 'SQLUSMALLINT' is used
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt ypes.h:105 : error: 'SQLUINTEGER' is used
as a type, but is not defined as a type.
In file included from C:/Program Files/Dev-Cpp/include/sqle xt.h:7,
from odbcutil.H:4,
from main.c:1:
C:/Program Files/Dev-Cpp/include/sql. h:346: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:346: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:348: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:348: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:349: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:349: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:349: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:351: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:351: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:352: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:352: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:357: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:358: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:358: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:360: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:360: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:362: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:362: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:363: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:364: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:364: error: type specifier omitted for
parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sql. h:364: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:365: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:365: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:366: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:366: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:367: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:367: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:368: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:368: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:368: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:369: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:369: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:370: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:370: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:372: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:372: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:373: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:374: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:374: error: type specifier omitted for
parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sql. h:375: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:375: error: type specifier omitted for
parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sql. h:376: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:376: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:376: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:377: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:377: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:378: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:378: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:379: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:379: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:379: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:381: error: type specifier omitted for
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql. h:381: error: type specifier omitted for
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql. h:381: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:382: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:382: error: type specifier omitted for
parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sql. h:382: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:384: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:384: error: type specifier omitted for
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql. h:384: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:384: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:385: error: `SQLHDESC' was not declared
in this scope
C:/Program Files/Dev-Cpp/include/sql. h:385: error: `SQLHDESC' was not declared
in this scope
C:/Program Files/Dev-Cpp/include/sql. h:385: error: initializer list being
treated as compound expression
C:/Program Files/Dev-Cpp/include/sql. h:386: error: type specifier omitted for
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql. h:388: error: type specifier omitted for
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql. h:389: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:390: error: `SQLHDESC' was not declared
in this scope
C:/Program Files/Dev-Cpp/include/sql. h:390: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sql. h:390: error: `SQLPOINTER' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sql. h:390: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sql. h:391: error: `SQLHDESC' was not declared
in this scope
C:/Program Files/Dev-Cpp/include/sql. h:391: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sql. h:391: error: `SQLCHAR' was not declared
in this scope
C:/Program Files/Dev-Cpp/include/sql. h:391: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sql. h:393: error: type specifier omitted for
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql. h:393: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:394: error: type specifier omitted for
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql. h:394: error: type specifier omitted for
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql. h:394: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:395: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:396: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:397: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:398: error: `SQLHDESC' was not declared
in this scope
C:/Program Files/Dev-Cpp/include/sql. h:398: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sql. h:398: error: `SQLPOINTER' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sql. h:398: error: syntax error before `)'
token
C:/Program Files/Dev-Cpp/include/sql. h:398: error: initializer list being
treated as compound expression
C:/Program Files/Dev-Cpp/include/sql. h:399: error: `SQLHDESC' was not declared
in this scope
C:/Program Files/Dev-Cpp/include/sql. h:399: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sql. h:400: error: `SQLPOINTER' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sql. h:400: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sql. h:401: error: type specifier omitted for
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql. h:402: error: type specifier omitted for
parameter `SQLPOINTER'
In file included from odbcutil.H:4,
from main.c:1:
C:/Program Files/Dev-Cpp/include/sqle xt.h:1184: error: type specifier omitted
for parameter `SQLHWND'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1184: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1184: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1185: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1185: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1186: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1186: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1187: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1187: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1187: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1188: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1188: error: type specifier omitted
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1188: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1189: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1189: error: type specifier omitted
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1189: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1190: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1190: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1192: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1192: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1194: error: type specifier omitted
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1194: error: type specifier omitted
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1194: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1195: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1195: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1196: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1196: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1197: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1197: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1198: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1198: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1198: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1199: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1199: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1200: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1200: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1200: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1201: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1201: error: type specifier omitted
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1201: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1202: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1202: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1203: error: syntax error before `('
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1204: error: syntax error before `('
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1205: error: `LPWSTR' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqle xt.h:1205: error: `LPWSTR' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqle xt.h:1205: error: initializer list being
treated as compound expression
C:/Program Files/Dev-Cpp/include/sqle xt.h:1207: error: syntax error before `('
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1208: error: redefinition of `int
DWORD'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1203: error: `int DWORD' previously
declared here
C:/Program Files/Dev-Cpp/include/sqle xt.h:1208: error: syntax error before `('
token
C:/Program Files/Dev-Cpp/include/sqle xt.h:1211: error: type specifier omitted
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1211: error: type specifier omitted
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqle xt.h:1211: error: syntax error before `*'
token
In file included from C:/Program Files/Dev-Cpp/include/sqle xt.h:1214,
from odbcutil.H:4,
from main.c:1:
C:/Program Files/Dev-Cpp/include/sqlu code.h:22: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:22: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:24: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:24: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:25: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:25: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:25: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:25: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:26: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:26: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:26: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:27: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:27: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:27: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:28: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:28: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:30: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:30: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:32: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:32: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:34: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:34: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:34: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:35: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:36: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:36: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:36: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:37: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:37: error: type specifier omitted
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:37: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:38: error: type specifier omitted
for parameter `SQLHWND'
C:/Program Files/Dev-Cpp/include/sqlu code.h:38: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:38: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:39: error: type specifier omitted
for parameter `SQLHWND'
C:/Program Files/Dev-Cpp/include/sqlu code.h:39: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:40: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:40: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:40: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:41: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:42: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:42: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:44: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:44: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:46: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:46: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:48: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:49: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:50: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:50: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:51: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:51: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:52: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:52: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:54: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:54: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:55: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:55: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:58: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:58: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:60: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:60: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:62: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:62: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:64: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:64: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:66: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:66: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:68: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:69: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:70: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:70: error: type specifier omitted
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:71: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:71: error: type specifier omitted
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:72: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:72: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:74: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:74: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:74: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:75: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:75: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:75: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:76: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:76: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:77: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:77: error: type specifier omitted
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu code.h:78: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:78: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:80: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:80: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:83: error: `SQLHDESC' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:83: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:83: error: `SQLPOINTER' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:83: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:84: error: `SQLHDESC' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:84: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:84: error: `SQLPOINTER' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:84: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:85: error: `SQLHDESC' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:85: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:85: error: `SQLPOINTER' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:85: error: syntax error before `)'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:85: error: initializer list being
treated as compound expression
C:/Program Files/Dev-Cpp/include/sqlu code.h:86: error: `SQLHDESC' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:86: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:86: error: `SQLPOINTER' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:86: error: syntax error before `)'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:86: error: initializer list being
treated as compound expression
C:/Program Files/Dev-Cpp/include/sqlu code.h:87: error: `SQLHDESC' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:87: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:87: error: `SQLCHAR' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:87: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:88: error: `SQLHDESC' was not
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu code.h:88: error: syntax error before `,'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:89: error: type specifier omitted
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqlu code.h:89: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:90: error: type specifier omitted
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqlu code.h:90: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:91: error: type specifier omitted
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqlu code.h:91: error: type specifier omitted
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu code.h:91: error: syntax error before `*'
token
C:/Program Files/Dev-Cpp/include/sqlu code.h:92: error: type specifier omitted
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqlu code.h:93: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:94: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:95: error: type specifier omitted
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu code.h:96: error: type specifier omitted
for parameter `SQLPOINTER'
In file included from main.c:1:
odbcutil.H:10: error: `SQLHANDLE' was not declared in this scope
odbcutil.H:10: error: syntax error before `)' token
In file included from getcount.H:3,
from main.c:2:
dbstatement.H:12: error: 'SQLHANDLE' is used as a type, but is not defined as a
type.
dbstatement.H:20: error: `SQLCHAR' was not declared in this scope
dbstatement.H:20: error: `stmt' was not declared in this scope
dbstatement.H:20: error: invalid data member initialization
dbstatement.H:20: error: (use `=' to initialize static data members)
dbstatement.H:20: error: declaration of `SQLRETURN DBstatement::exec'
dbstatement.H:19: error: conflicts with previous declaration `SQLRETURN
DBstatement::exec()'
dbstatement.H: In member function `SQLRETURN DBstatement::exec()':
dbstatement.H:19: error: `stmthandle' undeclared (first use this function)
dbstatement.H:19: error: (Each undeclared identifier is reported only once for
each function it appears in.)
main.c: In function `int main(int, char**)':
main.c:25: error: `SQLCHAR' undeclared (first use this function)
main.c:25: error: syntax error before `)' token
make.exe: *** [main.o] Error 1
Execution terminated
Compiler: Default compiler
Building Makefile: "D:\C++\ODBCTest\Makefile.
Executing make...
make.exe -f "D:\C++\ODBCTest\Makefile.
g++.exe -c main.c -o main.o -I"C:/GTK/INCLUDE" -I"C:/GTK/INCLUDE/GTK-2.0"
In file included from odbcutil.H:3,
from main.c:1:
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
token
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
C:/Program Files/Dev-Cpp/include/sqlt
as a type, but is not defined as a type.
In file included from C:/Program Files/Dev-Cpp/include/sqle
from odbcutil.H:4,
from main.c:1:
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
in this scope
C:/Program Files/Dev-Cpp/include/sql.
in this scope
C:/Program Files/Dev-Cpp/include/sql.
treated as compound expression
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
in this scope
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
declared in this scope
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
in this scope
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
in this scope
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
in this scope
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
declared in this scope
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
treated as compound expression
C:/Program Files/Dev-Cpp/include/sql.
in this scope
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
declared in this scope
C:/Program Files/Dev-Cpp/include/sql.
token
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sql.
parameter `SQLPOINTER'
In file included from odbcutil.H:4,
from main.c:1:
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLHWND'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
declared in this scope
C:/Program Files/Dev-Cpp/include/sqle
declared in this scope
C:/Program Files/Dev-Cpp/include/sqle
treated as compound expression
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
DWORD'
C:/Program Files/Dev-Cpp/include/sqle
declared here
C:/Program Files/Dev-Cpp/include/sqle
token
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqle
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqle
token
In file included from C:/Program Files/Dev-Cpp/include/sqle
from odbcutil.H:4,
from main.c:1:
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLHWND'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLHWND'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUINTEGER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLUSMALLINT'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
treated as compound expression
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
treated as compound expression
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
declared in this scope
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLCHAR'
C:/Program Files/Dev-Cpp/include/sqlu
token
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLHANDLE'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
C:/Program Files/Dev-Cpp/include/sqlu
for parameter `SQLPOINTER'
In file included from main.c:1:
odbcutil.H:10: error: `SQLHANDLE' was not declared in this scope
odbcutil.H:10: error: syntax error before `)' token
In file included from getcount.H:3,
from main.c:2:
dbstatement.H:12: error: 'SQLHANDLE' is used as a type, but is not defined as a
type.
dbstatement.H:20: error: `SQLCHAR' was not declared in this scope
dbstatement.H:20: error: `stmt' was not declared in this scope
dbstatement.H:20: error: invalid data member initialization
dbstatement.H:20: error: (use `=' to initialize static data members)
dbstatement.H:20: error: declaration of `SQLRETURN DBstatement::exec'
dbstatement.H:19: error: conflicts with previous declaration `SQLRETURN
DBstatement::exec()'
dbstatement.H: In member function `SQLRETURN DBstatement::exec()':
dbstatement.H:19: error: `stmthandle' undeclared (first use this function)
dbstatement.H:19: error: (Each undeclared identifier is reported only once for
each function it appears in.)
main.c: In function `int main(int, char**)':
main.c:25: error: `SQLCHAR' undeclared (first use this function)
main.c:25: error: syntax error before `)' token
make.exe: *** [main.o] Error 1
Execution terminated
Yowza! Looks like your ODBC header files are corrupt somehow. The errors seem to be in the sqltypes.h header file, which is a header provided by Microsoft. Try taking a look at that file. All the other errors are a result of missing types which are defined in that header.
ASKER
Here is a copy of what I got with Dev-C++ (4.9.9.0)
//sqltypes.h
#ifndef _SQLTYPES_H
#define _SQLTYPES_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define SQL_API __stdcall
#ifndef RC_INVOKED
#define __need_wchar_t
#include <stddef.h>
typedef signed char SCHAR;
typedef long SDWORD;
typedef short SWORD;
typedef ULONG UDWORD;
typedef USHORT UWORD;
typedef signed long SLONG;
typedef signed short SSHORT;
typedef double SDOUBLE;
typedef double LDOUBLE;
typedef float SFLOAT;
typedef PVOID PTR;
typedef PVOID HENV;
typedef PVOID HDBC;
typedef PVOID HSTMT;
typedef short RETCODE;
typedef UCHAR SQLCHAR;
typedef SCHAR SQLSCHAR;
typedef SDWORD SQLINTEGER;
typedef SWORD SQLSMALLINT;
#ifndef __WIN64
typedef UDWORD SQLUINTEGER;
#endif
typedef UWORD SQLUSMALLINT;
typedef PVOID SQLPOINTER;
#if (ODBCVER >= 0x0300)
typedef void* SQLHANDLE;
typedef SQLHANDLE SQLHENV;
typedef SQLHANDLE SQLHDBC;
typedef SQLHANDLE SQLHSTMT;
typedef SQLHANDLE SQLHDESC;
#else
typedef void* SQLHENV;
typedef void* SQLHDBC;
typedef void* SQLHSTMT;
#endif
typedef SQLSMALLINT SQLRETURN;
typedef HWND SQLHWND;
typedef ULONG BOOKMARK;
#ifdef _WIN64
typedef INT64 SQLLEN;
typedef INT64 SQLROWOFFSET;
typedef UINT64 SQLROWCOUNT;
typedef UINT64 SQLULEN;
typedef UINT64 SQLTRANSID;
typedef unsigned long SQLSETPOSIROW;
#else
#define SQLLEN SQLINTEGER
#define SQLROWOFFSET SQLINTEGER
#define SQLROWCOUNT SQLUINTEGER
#define SQLULEN SQLUINTEGER
#define SQLTRANSID DWORD
#define SQLSETPOSIROW SQLUSMALLINT
#endif
typedef wchar_t SQLWCHAR;
#ifdef UNICODE
typedef SQLWCHAR SQLTCHAR;
#else
typedef SQLCHAR SQLTCHAR;
#endif /* UNICODE */
#if (ODBCVER >= 0x0300)
typedef unsigned char SQLDATE;
typedef unsigned char SQLDECIMAL;
typedef double SQLDOUBLE;
typedef double SQLFLOAT;
typedef unsigned char SQLNUMERIC;
typedef float SQLREAL;
typedef unsigned char SQLTIME;
typedef unsigned char SQLTIMESTAMP;
typedef unsigned char SQLVARCHAR;
#define ODBCINT64 __int64
typedef __int64 SQLBIGINT;
typedef unsigned __int64 SQLUBIGINT;
#endif
typedef struct tagDATE_STRUCT {
SQLSMALLINT year;
SQLUSMALLINT month;
SQLUSMALLINT day;
} DATE_STRUCT;
typedef struct tagTIME_STRUCT {
SQLUSMALLINT hour;
SQLUSMALLINT minute;
SQLUSMALLINT second;
} TIME_STRUCT;
typedef struct tagTIMESTAMP_STRUCT {
SQLSMALLINT year;
SQLUSMALLINT month;
SQLUSMALLINT day;
SQLUSMALLINT hour;
SQLUSMALLINT minute;
SQLUSMALLINT second;
SQLUINTEGER fraction;
} TIMESTAMP_STRUCT;
#if (ODBCVER >= 0x0300)
typedef DATE_STRUCT SQL_DATE_STRUCT;
typedef TIME_STRUCT SQL_TIME_STRUCT;
typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT;
typedef enum {
SQL_IS_YEAR = 1,SQL_IS_MONTH,SQL_IS_DAY, SQL_IS_HOU R,
SQL_IS_MINUTE,SQL_IS_SECON D,SQL_IS_Y EAR_TO_MON TH,SQL_IS_ DAY_TO_HOU R,
SQL_IS_DAY_TO_MINUTE,SQL_I S_DAY_TO_S ECOND,SQL_ IS_HOUR_TO _MINUTE,
SQL_IS_HOUR_TO_SECOND,SQL_ IS_MINUTE_ TO_SECOND
} SQLINTERVAL;
typedef struct tagSQL_YEAR_MONTH {
SQLUINTEGER year;
SQLUINTEGER month;
} SQL_YEAR_MONTH_STRUCT;
typedef struct tagSQL_DAY_SECOND {
SQLUINTEGER day;
SQLUINTEGER hour;
SQLUINTEGER minute;
SQLUINTEGER second;
SQLUINTEGER fraction;
} SQL_DAY_SECOND_STRUCT;
typedef struct tagSQL_INTERVAL_STRUCT {
SQLINTERVAL interval_type;
SQLSMALLINT interval_sign;
union {
SQL_YEAR_MONTH_STRUCT year_month;
SQL_DAY_SECOND_STRUCT day_second;
} intval;
} SQL_INTERVAL_STRUCT;
#define SQL_MAX_NUMERIC_LEN 16
typedef struct tagSQL_NUMERIC_STRUCT {
SQLCHAR precision;
SQLSCHAR scale;
SQLCHAR sign;
SQLCHAR val[SQL_MAX_NUMERIC_LEN];
} SQL_NUMERIC_STRUCT;
#endif /* ODBCVER >= 0x0300 */
#if (ODBCVER >= 0x0350)
#ifdef _GUID_DEFINED
# warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
#endif
#if defined _GUID_DEFINED || defined GUID_DEFINED
typedef GUID SQLGUID;
#else
typedef struct tagSQLGUID{
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[ 8 ];
} SQLGUID;
#endif /* GUID_DEFINED */
#endif /* ODBCVER >= 0x0350 */
#endif /* RC_INVOKED */
#ifdef __cplusplus
}
#endif
#endif
//sqltypes.h
#ifndef _SQLTYPES_H
#define _SQLTYPES_H
#if __GNUC__ >=3
#pragma GCC system_header
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define SQL_API __stdcall
#ifndef RC_INVOKED
#define __need_wchar_t
#include <stddef.h>
typedef signed char SCHAR;
typedef long SDWORD;
typedef short SWORD;
typedef ULONG UDWORD;
typedef USHORT UWORD;
typedef signed long SLONG;
typedef signed short SSHORT;
typedef double SDOUBLE;
typedef double LDOUBLE;
typedef float SFLOAT;
typedef PVOID PTR;
typedef PVOID HENV;
typedef PVOID HDBC;
typedef PVOID HSTMT;
typedef short RETCODE;
typedef UCHAR SQLCHAR;
typedef SCHAR SQLSCHAR;
typedef SDWORD SQLINTEGER;
typedef SWORD SQLSMALLINT;
#ifndef __WIN64
typedef UDWORD SQLUINTEGER;
#endif
typedef UWORD SQLUSMALLINT;
typedef PVOID SQLPOINTER;
#if (ODBCVER >= 0x0300)
typedef void* SQLHANDLE;
typedef SQLHANDLE SQLHENV;
typedef SQLHANDLE SQLHDBC;
typedef SQLHANDLE SQLHSTMT;
typedef SQLHANDLE SQLHDESC;
#else
typedef void* SQLHENV;
typedef void* SQLHDBC;
typedef void* SQLHSTMT;
#endif
typedef SQLSMALLINT SQLRETURN;
typedef HWND SQLHWND;
typedef ULONG BOOKMARK;
#ifdef _WIN64
typedef INT64 SQLLEN;
typedef INT64 SQLROWOFFSET;
typedef UINT64 SQLROWCOUNT;
typedef UINT64 SQLULEN;
typedef UINT64 SQLTRANSID;
typedef unsigned long SQLSETPOSIROW;
#else
#define SQLLEN SQLINTEGER
#define SQLROWOFFSET SQLINTEGER
#define SQLROWCOUNT SQLUINTEGER
#define SQLULEN SQLUINTEGER
#define SQLTRANSID DWORD
#define SQLSETPOSIROW SQLUSMALLINT
#endif
typedef wchar_t SQLWCHAR;
#ifdef UNICODE
typedef SQLWCHAR SQLTCHAR;
#else
typedef SQLCHAR SQLTCHAR;
#endif /* UNICODE */
#if (ODBCVER >= 0x0300)
typedef unsigned char SQLDATE;
typedef unsigned char SQLDECIMAL;
typedef double SQLDOUBLE;
typedef double SQLFLOAT;
typedef unsigned char SQLNUMERIC;
typedef float SQLREAL;
typedef unsigned char SQLTIME;
typedef unsigned char SQLTIMESTAMP;
typedef unsigned char SQLVARCHAR;
#define ODBCINT64 __int64
typedef __int64 SQLBIGINT;
typedef unsigned __int64 SQLUBIGINT;
#endif
typedef struct tagDATE_STRUCT {
SQLSMALLINT year;
SQLUSMALLINT month;
SQLUSMALLINT day;
} DATE_STRUCT;
typedef struct tagTIME_STRUCT {
SQLUSMALLINT hour;
SQLUSMALLINT minute;
SQLUSMALLINT second;
} TIME_STRUCT;
typedef struct tagTIMESTAMP_STRUCT {
SQLSMALLINT year;
SQLUSMALLINT month;
SQLUSMALLINT day;
SQLUSMALLINT hour;
SQLUSMALLINT minute;
SQLUSMALLINT second;
SQLUINTEGER fraction;
} TIMESTAMP_STRUCT;
#if (ODBCVER >= 0x0300)
typedef DATE_STRUCT SQL_DATE_STRUCT;
typedef TIME_STRUCT SQL_TIME_STRUCT;
typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT;
typedef enum {
SQL_IS_YEAR = 1,SQL_IS_MONTH,SQL_IS_DAY,
SQL_IS_MINUTE,SQL_IS_SECON
SQL_IS_DAY_TO_MINUTE,SQL_I
SQL_IS_HOUR_TO_SECOND,SQL_
} SQLINTERVAL;
typedef struct tagSQL_YEAR_MONTH {
SQLUINTEGER year;
SQLUINTEGER month;
} SQL_YEAR_MONTH_STRUCT;
typedef struct tagSQL_DAY_SECOND {
SQLUINTEGER day;
SQLUINTEGER hour;
SQLUINTEGER minute;
SQLUINTEGER second;
SQLUINTEGER fraction;
} SQL_DAY_SECOND_STRUCT;
typedef struct tagSQL_INTERVAL_STRUCT {
SQLINTERVAL interval_type;
SQLSMALLINT interval_sign;
union {
SQL_YEAR_MONTH_STRUCT year_month;
SQL_DAY_SECOND_STRUCT day_second;
} intval;
} SQL_INTERVAL_STRUCT;
#define SQL_MAX_NUMERIC_LEN 16
typedef struct tagSQL_NUMERIC_STRUCT {
SQLCHAR precision;
SQLSCHAR scale;
SQLCHAR sign;
SQLCHAR val[SQL_MAX_NUMERIC_LEN];
} SQL_NUMERIC_STRUCT;
#endif /* ODBCVER >= 0x0300 */
#if (ODBCVER >= 0x0350)
#ifdef _GUID_DEFINED
# warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
#endif
#if defined _GUID_DEFINED || defined GUID_DEFINED
typedef GUID SQLGUID;
#else
typedef struct tagSQLGUID{
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[ 8 ];
} SQLGUID;
#endif /* GUID_DEFINED */
#endif /* ODBCVER >= 0x0350 */
#endif /* RC_INVOKED */
#ifdef __cplusplus
}
#endif
#endif
Ah! I now see your problem. You are using Dev-C++ header files, but should be using Microsoft's header files. You need to have C:\Program Files\Microsoft Visual Studio\VC98\Include (or something similar) in your include path ahead of Dev-C++ includes so that you are using the right headers. If you do not have Visual Studio then you need to get the freely downloadable compiler (with various headers) from Microsoft at http://msdn.microsoft.com/visualc/vctoolkit2003/
You may find that you are better off using the Microsoft compiler anyway.
You may find that you are better off using the Microsoft compiler anyway.
ASKER
I have Visual C++ 6 and 2003.net but I was trying to avoid using it for cross-platform compatibility. I'm gonna try with the MDAC SDK kit which says it has the headers also.
ASKER
I just loaded up Visual Studio 2003 and started a new Visual C++ project and the SLXTest.cpp (main source file) only has
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#include <sql.h>
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
// TODO: Please replace the sample code below with your own.
Console::WriteLine(S"Hello World");
return 0;
}
And this still comes up with syntax errors in sqltypes.h
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#include <sql.h>
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
// TODO: Please replace the sample code below with your own.
Console::WriteLine(S"Hello
return 0;
}
And this still comes up with syntax errors in sqltypes.h
ASKER
------ Build started: Project: SQLTest, Configuration: Debug Win32 ------
Compiling...
SQLTest.cpp
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(137) : error C2146: syntax error : missing ';' before identifier 'SQLHWND'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(137) : error C2501: 'SQLHWND' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(275) : error C2146: syntax error : missing ';' before identifier 'Data1'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(275) : error C2501: 'tagSQLGUID::DWORD' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(275) : error C2501: 'tagSQLGUID::Data1' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(276) : error C2146: syntax error : missing ';' before identifier 'Data2'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(276) : error C2501: 'tagSQLGUID::WORD' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(276) : error C2501: 'tagSQLGUID::Data2' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(277) : error C2146: syntax error : missing ';' before identifier 'Data3'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(277) : error C2501: 'tagSQLGUID::WORD' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(277) : error C2501: 'tagSQLGUID::Data3' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(278) : error C2146: syntax error : missing ';' before identifier 'Data4'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(278) : error C2501: 'tagSQLGUID::BYTE' : missing storage-class or type specifiers
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu de\sqltype s.h(278) : error C2501: 'tagSQLGUID::Data4' : missing storage-class or type specifiers
Build log was saved at "file://c:\Documents and Settings\ncg\My Documents\Visual Studio Projects\SQLTest\SQLTest\D ebug\Build Log.htm"
SQLTest - 14 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
Compiling...
SQLTest.cpp
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Inclu
Build log was saved at "file://c:\Documents and Settings\ncg\My Documents\Visual Studio Projects\SQLTest\SQLTest\D
SQLTest - 14 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
At this point, I'm baffled. This appears to be a system header problem, and one I've never encountered (I don't really develop on Windows). Best of luck, but I've reached the end of my expertise here. Sorry.
ASKER
Thanks for all your help anyway. I've gotten a bit further than yesterday. I had to include windows.h as USHORT and ULONG and some other typedef's are defined in that.
Would it help if I upload the project I've got (with your files)? I changed main.c to main.cpp but I don't think that should make a difference.
Would it help if I upload the project I've got (with your files)? I changed main.c to main.cpp but I don't think that should make a difference.
Since I don't have a Windows box to work on, having your project won't help. Changing main.c to main.cpp shouldn't make much difference. (Though it may get the compiler to treat it as C++ rather than C, which is desirable, it doesn't change what's going on with these errors.) Good luck.
If you are strapped for funds and you are targetting Windows, Qt will not help you. The X11 and MacOS X versions are licensed under both the GNU GPL and a (somewhat costly) commercial license, but the Windows version is only available under the commercial license (there exists an older non-commercial version that does not include the database API, as well as a more recent non-commercial version that may or may not but is hard to find).
Both APIs have their unique failings, but the most important problem with both is that drivers for commercial databases are largely unavailable for non-Windows platforms. If you really need cross-platform compatibility with any and all databases, you will want to use Java and JDBC. JDBC drivers are available for essentially all RDBMSs, and almost all are pure Java and, therefore, cross-platform. It is possible to do your database work in Java and any other part of your program in C++, but you can expect it to be a pain.