After three days of trying I gave up! Can not compile a very simple code:
#include <stdio.h>
#include <sql.h>
#include <sqlext.h>
main() {
#define WIN32_LEAN_AND_MEAN
SQLHENV env;
char driver[256];
char attr[256];
SQLSMALLINT driver_ret;
SQLSMALLINT attr_ret;
SQLUSMALLINT direction;
SQLRETURN ret;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
direction = SQL_FETCH_FIRST;
while(SQL_SUCCEEDED(ret = SQLDrivers(env, direction,
driver, sizeof(driver), &driver_ret,
attr, sizeof(attr), &attr_ret))) {
direction = SQL_FETCH_NEXT;
printf("%s - %s\n", driver, attr);
if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
}
}
I get about three or four errors per statement; most of them are from include files. Below is a paste of some 10 lines of errors:
Building ConnecttoSQL.obj.
C:\Program Files\PellesC\Include\Win\sqltypes.h(73): warning #2099: Missing type specifier.
C:\Program Files\PellesC\Include\Win\sqltypes.h(73): error #2001: Syntax error: expected ';' but found 'SQLHWND'.
C:\Program Files\PellesC\Include\Win\sqltypes.h(73): warning #2099: Missing type specifier.
C:\Program Files\PellesC\Include\Win\sqltypes.h(75): error #2121: Redeclaration of 'SQLSCHAR'.
C:\Program Files\PellesC\Include\Win\sqltypes.h(163): warning #2099: Missing type specifier.
C:\Program Files\PellesC\Include\Win\sqltypes.h(163): error #2001: Syntax error: expected ';' but found 'SQLBIGINT'.
C:\Program Files\PellesC\Include\Win\sqltypes.h(163): warning #2099: Missing type specifier.
C:\Program Files\PellesC\Include\Win\sqltypes.h(164): error #2121: Redeclaration of '__int64'.
C:\Program Files\PellesC\Include\Win\sqltypes.h(164): error #2001: Syntax error: expected ';' but found 'SQLUBIGINT'.
C:\Program Files\PellesC\Include\Win\sqltypes.h(164): warning #2099: Missing type specifier.
C:\Program Files\PellesC\Include\Win\sqltypes.h(180): error #2078: Invalid struct field declarations.
C:\Program Files\PellesC\Include\Win\sqltypes.h(180): error #2001: Syntax error: expected '}' but found 'DWORD'.
C:\Program Files\PellesC\Include\Win\sqltypes.h(181): warning #2099: Missing type specifier.
C:\Program Files\PellesC\Include\Win\sqltypes.h(181): error #2001: Syntax error: expected ';' but found 'Data2'.
Must be that I am doing something very very wrong. There is also one peculiar thing: when i type the program lines all letters are in uppercase. No, I don't have caps lock
as everyone can see from this text. I suspect I have really beginners troubles, which have been already solved before, but i can't find solution in this forum.
Please heeeeeeelp!!!!