simple ODBC Connection in C++ (Dev C++ in a windows environment)

I'm trying to write a simple C++ program that will live on a variety of Windows platforms (98 through XP).

The program reads a simple configuration file, and depending on one of those variables, it obtains data either from a file or a database and sftp's it to my company's server for processing.

Everything works fine except the connection to the databases.  
I'm writing the program in Dev C++ in a Windows environment, and I'm trying to connect to a Sybase DB that has an ODBC connection already set up.

I've scoured the internet and not come up with a viable example to work off of.

Can someone please give me a little guidance on using hy IDE to access a simple ODBC connection?
...
#include <sql.h>
#include <sqltypes.h>
#include <sqlext.h>
...
 
if (vendor == "1") { //** Micros - v.3.2 and older
       SQLHandle hdlEnv, hdlConn, hdlStmt, hdlDbc
       char* stmt = "SELECT * from NutHead"; //SQL statement? NutHead is the Table name
 
       //for example
       char *dsnName = COLLECTOR ? name of your program or what ever&..
       char* userID = "eXceed";
       char* passwd = "hole";
       char* retVal[256];
       unsigned int cbData;
 
       SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hdlEnv);
       SQLSetEnvAttr(hdlEnv,SQL_ATTR_ODBC_VERSION,(void*)SQL_OV_ODBC30);
       SQLAllocHandle(SQL_HANDLE_DBC, hdlEnv, &hdlConn);
       SQLConnect(hdlConn, SQLCHAR*)dsnName,SQL_NTS,(SQLCHAR*)userID,SQL_NTS, (SQLCHAR*)passwd, SQL_NTS);
       SQLAllocHandle(SQL_HANDLE_STMT, hdlDbc, &hdlStmt);
       SQLExecDirect(hdlStmt, (SQLCHAR*)stmt, SQL_NTS);
       
       //Initialize the database connection
 
       while(SQLFetch(hdlStmt) == SQL_SUCCEEDED) {
          SQLGetData(hdlStmt,0,DT_STRING,retVal,256,&cbData);
          std::cout << retVal << std::endl;
       }
       
       SQLFreeHandle(SQL_HANDLE_STMT, hdlStmt);
       SQLFreeHandle(SQL_HANDLE_DBC, hdlConn);
       SQLFreeHandle(SQL_HANDLE_ENV, hdlEnv);  //End the connection
    }

Open in new window

jamied66Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
DanRollinsConnect With a Mentor Commented:
I've attached a working example.  That ought to get you started.  Just use a loop on the SQLGetData line, as you did in your own code.

Incidently, it is rare to need to program at this level.  Nearly all systems provide class objects to wrap these low-level functions and simplify it considerably.

-- Dan
#include <sql.h>
#include <sqltypes.h>
#include <sqlext.h>
#pragma comment(lib, "Odbc32.lib" )
 
void CD48Dlg::OnButton3() 
{
	char* szStmt= "SELECT MyClm FROM MyTbl"; // SQL statement
 
	UCHAR* szDSN = (UCHAR*)"MyDSN";        // DSN
	UCHAR* szUID = (UCHAR*)"MyUser";       // db User ID
	UCHAR* szPWD = (UCHAR*)"MyPassword";   // Db User's password
 
	UCHAR  szRetVal[256];
	long  cbData;
 
	HENV   hEnv = NULL; // Env Handle from SQLAllocEnv()
	HDBC   hDBC = NULL; // Connection handle
	HSTMT  hStmt= NULL; // Statment handle 
 
	int nRet;
	nRet= SQLAllocEnv(    &hEnv );
	nRet= SQLAllocConnect( hEnv, &hDBC );
	nRet= SQLConnect( hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPWD, SQL_NTS);
 
	nRet= SQLAllocHandle( SQL_HANDLE_STMT, hDBC, &hStmt );
	nRet= SQLExecDirect(  hStmt, (SQLCHAR*)szStmt, SQL_NTS);
 
	nRet= SQLFetch( hStmt );
	nRet= SQLGetData(hStmt,1,SQL_C_CHAR, szRetVal, 256, &cbData );   // get first data column
	// std::cout << szRetVal << std::endl;
 
	SQLFreeHandle( SQL_HANDLE_STMT, hStmt );
	SQLFreeHandle( SQL_HANDLE_DBC, hDBC   );
	SQLFreeHandle( SQL_HANDLE_ENV, hEnv   );  
}

Open in new window

0
 
itsmeandnobodyelseCommented:
>>>> Incidently, it is rare to need to program at this level.  
Hmmm, that isn't quite true. For instance, if you need to make portable database programming, there is hardly an alternative to native ODBC. Sometimes these class wrappers connect to one DBMS type only. Or they implement only the smallest common part of the supported databases. And though there are many ODBC class wrappers, I know none, where you could adopt the above sample with lesser code...  

Regards, Alex
0
 
jamied66Author Commented:
I'm sorry this took so long to respond to.  I was sidetracked on another project for a little while.

I copied your example, ver batim, into my install of Dev C++, just to see if it would compile.

Here is what I compliled (after linking lib/libodbc32.a from the Dev C++ lib folder in the Project Options panel)

I've also included the Compile Log (324 errors).

C++ is far from my natural environment (a PHP/Perl guy).  But if I can just get a testable connection to this database I'll be home free.

All help is appreciated, again.


#include <cstdlib>
#include <iostream>
#include <sql.h>
#include <sqltypes.h>
#include <sqlext.h>
#pragma comment(lib, "Odbc32.lib" )
 
void CD48Dlg::OnButton3() 
{
        char* szStmt= "SELECT MyClm FROM MyTbl"; // SQL statement
 
        UCHAR* szDSN = (UCHAR*)"MyDSN";        // DSN
        UCHAR* szUID = (UCHAR*)"MyUser";       // db User ID
        UCHAR* szPWD = (UCHAR*)"MyPassword";   // Db User's password
 
        UCHAR  szRetVal[256];
        long  cbData;
 
        HENV   hEnv = NULL; // Env Handle from SQLAllocEnv()
        HDBC   hDBC = NULL; // Connection handle
        HSTMT  hStmt= NULL; // Statment handle 
 
        int nRet;
        nRet= SQLAllocEnv(    &hEnv );
        nRet= SQLAllocConnect( hEnv, &hDBC );
        nRet= SQLConnect( hDBC, szDSN, SQL_NTS, szUID, SQL_NTS, szPWD, SQL_NTS);
 
        nRet= SQLAllocHandle( SQL_HANDLE_STMT, hDBC, &hStmt );
        nRet= SQLExecDirect(  hStmt, (SQLCHAR*)szStmt, SQL_NTS);
 
        nRet= SQLFetch( hStmt );
        nRet= SQLGetData(hStmt,1,SQL_C_CHAR, szRetVal, 256, &cbData );   // get first data column
        // std::cout << szRetVal << std::endl;
 
        SQLFreeHandle( SQL_HANDLE_STMT, hStmt );
        SQLFreeHandle( SQL_HANDLE_DBC, hDBC   );
        SQLFreeHandle( SQL_HANDLE_ENV, hEnv   );  
}
 
 
 
 
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing  make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -D__DEBUG__ -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"    -g3
 
In file included from C:/Dev-Cpp/include/sql.h:13,
                 from main.cpp:3:
C:/Dev-Cpp/include/sqltypes.h:17: error: `ULONG' does not name a type
C:/Dev-Cpp/include/sqltypes.h:18: error: `USHORT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:24: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:25: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:26: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:27: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:29: error: `UCHAR' does not name a type
C:/Dev-Cpp/include/sqltypes.h:34: error: `UDWORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:36: error: `UWORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:37: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:50: error: `HWND' does not name a type
C:/Dev-Cpp/include/sqltypes.h:51: error: `ULONG' does not name a type
C:/Dev-Cpp/include/sqltypes.h:71: error: `SQLCHAR' does not name a type
C:/Dev-Cpp/include/sqltypes.h:90: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:91: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:94: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:95: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:96: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:100: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:101: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:102: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:103: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:104: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:105: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:118: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:119: error: `SQLUINTEGER' does not name a type
 
C:/Dev-Cpp/include/sqltypes.h:122: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:123: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:124: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:125: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:126: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:138: error: `SQLCHAR' does not name a type
 
C:/Dev-Cpp/include/sqltypes.h:140: error: `SQLCHAR' does not name a type
C:/Dev-Cpp/include/sqltypes.h:141: error: `SQLCHAR' does not name a type
C:/Dev-Cpp/include/sqltypes.h:154: error: `DWORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:155: error: `WORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:156: error: `WORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:157: error: `BYTE' does not name a type
In file included from main.cpp:3:
C:/Dev-Cpp/include/sql.h:346: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:346: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:348: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:348: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:348: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:349: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:349: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:349: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:351: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:351: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:352: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:357: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:358: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:360: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:362: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:363: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:364: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:364: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:364: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:365: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:365: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:365: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:365: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:366: error: `SQLUSMALLINT' has not been declared
 
C:/Dev-Cpp/include/sql.h:366: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:367: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:367: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:368: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:368: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:369: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:369: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:370: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:370: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:372: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:373: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:374: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:374: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:375: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:375: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:377: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sql.h:377: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:377: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:377: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:377: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:378: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:378: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:378: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:378: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:379: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:379: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:379: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:382: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:382: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:382: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:384: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:384: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:384: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:384: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:389: error: `SQLPOINTER' has not been declared
 
C:/Dev-Cpp/include/sql.h:390: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:391: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:393: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:394: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:394: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:395: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:396: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:397: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:398: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:400: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:401: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:402: error: `SQLPOINTER' has not been declared
In file included from main.cpp:5:
C:/Dev-Cpp/include/sqlext.h:1184: error: `SQLHWND' has not been declared
 
C:/Dev-Cpp/include/sqlext.h:1184: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1184: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1184: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1185: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1185: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1186: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1186: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1186: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1186: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1187: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1187: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1187: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1188: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1188: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1189: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1189: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1189: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1192: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1192: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1194: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1194: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1195: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1195: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1195: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1196: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1196: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1196: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1196: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1197: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1197: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1197: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1198: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1198: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1198: error: `SQLUSMALLINT' has not been declared
 
C:/Dev-Cpp/include/sqlext.h:1199: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1199: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1199: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1200: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1200: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1200: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1201: error: `SQLUSMALLINT' has not been declared
 
C:/Dev-Cpp/include/sqlext.h:1201: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1201: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1202: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1202: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1203: error: expected constructor, destructor, or type conversion before "ODBCGetTryWaitValue"
C:/Dev-Cpp/include/sqlext.h:1203: error: expected `,' or `;' before "ODBCGetTryWaitValue"
 
C:/Dev-Cpp/include/sqlext.h:1204: error: expected constructor, destructor, or type conversion before "ODBCSetTryWaitValue"
C:/Dev-Cpp/include/sqlext.h:1204: error: expected `,' or `;' before "ODBCSetTryWaitValue"
C:/Dev-Cpp/include/sqlext.h:1205: error: `LPWSTR' was not declared in this scope
C:/Dev-Cpp/include/sqlext.h:1205: error: `LPWSTR' was not declared in this scope
C:/Dev-Cpp/include/sqlext.h:1205: error: `DWORD' was not declared in this scope
C:/Dev-Cpp/include/sqlext.h:1205: error: initializer expression list treated as compound expression
C:/Dev-Cpp/include/sqlext.h:1207: error: expected constructor, destructor, or type conversion before "TraceReturn"
C:/Dev-Cpp/include/sqlext.h:1207: error: expected `,' or `;' before "TraceReturn"
C:/Dev-Cpp/include/sqlext.h:1208: error: expected constructor, destructor, or type conversion before "TraceVersion"
C:/Dev-Cpp/include/sqlext.h:1208: error: expected `,' or `;' before "TraceVersion"
In file included from C:/Dev-Cpp/include/sqlext.h:1214,
                 from main.cpp:5:
C:/Dev-Cpp/include/sqlucode.h:22: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:22: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:24: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:24: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:25: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:25: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:25: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:25: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:26: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:26: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:26: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:27: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:27: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:27: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:28: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:28: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:28: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:28: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:30: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:30: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:30: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:30: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:32: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:32: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:32: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:34: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:34: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:34: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:35: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:36: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:36: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:36: error: `SQLUINTEGER' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:37: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:37: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:38: error: `SQLHWND' has not been declared
C:/Dev-Cpp/include/sqlucode.h:38: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:38: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:38: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:39: error: `SQLHWND' has not been declared
C:/Dev-Cpp/include/sqlucode.h:39: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:40: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:40: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:40: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:41: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:42: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:42: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:44: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:48: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:49: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:50: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:50: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:51: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:51: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:52: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:54: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:54: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:55: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:55: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:58: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:58: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:60: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:62: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:62: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:62: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:64: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:64: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:64: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:64: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:66: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:66: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:66: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:68: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:69: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:70: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:70: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:71: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:71: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:72: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:75: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:75: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:75: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:77: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:77: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:78: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:78: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:78: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:80: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:80: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:80: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:80: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:83: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:84: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:85: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:86: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:87: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:89: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:90: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:91: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:91: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:93: error: `SQLPOINTER' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:94: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:95: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:96: error: `SQLPOINTER' has not been declared
main.cpp:8: error: `CD48Dlg' has not been declared
main.cpp: In function `void OnButton3()':
main.cpp:12: error: `UCHAR' undeclared (first use this function)
main.cpp:12: error: (Each undeclared identifier is reported only once for each function it appears in.)
main.cpp:12: error: `szDSN' undeclared (first use this function)
main.cpp:12: error: expected primary-expression before ')' token
main.cpp:12: error: expected `;' before string constant
main.cpp:13: error: `szUID' undeclared (first use this function)
 
main.cpp:13: error: expected primary-expression before ')' token
main.cpp:13: error: expected `;' before string constant
main.cpp:14: error: `szPWD' undeclared (first use this function)
main.cpp:14: error: expected primary-expression before ')' token
main.cpp:14: error: expected `;' before string constant
main.cpp:16: error: expected `;' before "szRetVal"
main.cpp:19: error: `HENV' undeclared (first use this function)
main.cpp:19: error: expected `;' before "hEnv"
main.cpp:20: error: `HDBC' undeclared (first use this function)
main.cpp:20: error: expected `;' before "hDBC"
main.cpp:21: error: `HSTMT' undeclared (first use this function)
 
main.cpp:21: error: expected `;' before "hStmt"
main.cpp:24: error: `hEnv' undeclared (first use this function)
main.cpp:25: error: `hDBC' undeclared (first use this function)
main.cpp:28: error: `hStmt' undeclared (first use this function)
main.cpp:29: error: `SQLCHAR' undeclared (first use this function)
main.cpp:29: error: expected primary-expression before ')' token
main.cpp:32: error: `szRetVal' undeclared (first use this function)
 
make.exe: *** [main.o] Error 1
 
Execution terminated

Open in new window

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
jamied66Author Commented:
I'm using Dev C++ 4.9.9.2, by the way.  I'm steering clear of VC++ because this particular little application needs to run with no dependency on a runtime library or any other system environment that may have to be installed.

Thanks again.
0
 
jamied66Author Commented:
it looks like the issue stems back to sqltypes.h
using the following code, I get 299 compile errors, even after linking to every library that I can conceive of.  code and complie log off of Dev C++ follow:



#include <cstdlib>
#include <iostream>
#include <sql.h>
#include<sqltypes.h>
#include<sqlext.h>
#include<windows.h>
 
using namespace std;
 
int main(int argc, char *argv[])
{
    system("PAUSE");
    return EXIT_SUCCESS;
}
 
 
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Makefile.win"
Executing  make...
make.exe -f "C:\Dev-Cpp\Makefile.win" all
g++.exe -D__DEBUG__ -c sql.cpp -o sql.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include"  -I"C:/Dev-Cpp/include/c++/3.4.2/backward"  -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32"  -I"C:/Dev-Cpp/include/c++/3.4.2"  -I"C:/Dev-Cpp/include"    -g3
 
In file included from C:/Dev-Cpp/include/sql.h:13,
                 from sql.cpp:3:
C:/Dev-Cpp/include/sqltypes.h:17: error: `ULONG' does not name a type
C:/Dev-Cpp/include/sqltypes.h:18: error: `USHORT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:24: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:25: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:26: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:27: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:29: error: `UCHAR' does not name a type
 
C:/Dev-Cpp/include/sqltypes.h:34: error: `UDWORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:36: error: `UWORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:37: error: `PVOID' does not name a type
C:/Dev-Cpp/include/sqltypes.h:50: error: `HWND' does not name a type
C:/Dev-Cpp/include/sqltypes.h:51: error: `ULONG' does not name a type
C:/Dev-Cpp/include/sqltypes.h:71: error: `SQLCHAR' does not name a type
C:/Dev-Cpp/include/sqltypes.h:90: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:91: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:94: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:95: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:96: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:100: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:101: error: `SQLUSMALLINT' does not name a type
 
C:/Dev-Cpp/include/sqltypes.h:102: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:103: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:104: error: `SQLUSMALLINT' does not name a type
C:/Dev-Cpp/include/sqltypes.h:105: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:118: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:119: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:122: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:123: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:124: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:125: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:126: error: `SQLUINTEGER' does not name a type
C:/Dev-Cpp/include/sqltypes.h:138: error: `SQLCHAR' does not name a type
C:/Dev-Cpp/include/sqltypes.h:140: error: `SQLCHAR' does not name a type
C:/Dev-Cpp/include/sqltypes.h:141: error: `SQLCHAR' does not name a type
C:/Dev-Cpp/include/sqltypes.h:154: error: `DWORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:155: error: `WORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:156: error: `WORD' does not name a type
C:/Dev-Cpp/include/sqltypes.h:157: error: `BYTE' does not name a type
In file included from sql.cpp:3:
C:/Dev-Cpp/include/sql.h:346: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:346: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:348: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:348: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:348: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sql.h:349: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:349: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:349: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:351: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:351: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:352: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:357: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:358: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:360: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:362: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:363: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:364: error: `SQLUSMALLINT' has not been declared
 
C:/Dev-Cpp/include/sql.h:364: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:364: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:365: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:365: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:365: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:365: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:366: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:366: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:367: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:367: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:368: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:368: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:369: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:369: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:370: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:370: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:372: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:373: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:374: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:374: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:375: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:375: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:376: error: `SQLUSMALLINT' has not been declared
 
C:/Dev-Cpp/include/sql.h:377: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:377: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:377: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:377: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:377: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:378: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:378: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:378: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:378: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sql.h:379: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:379: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:379: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:382: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:382: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sql.h:382: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:384: error: `SQLUSMALLINT' has not been declared
 
C:/Dev-Cpp/include/sql.h:384: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sql.h:384: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:384: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:389: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:390: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:391: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:393: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:394: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:394: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sql.h:395: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:396: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:397: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:398: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:400: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sql.h:401: error: `SQLPOINTER' has not been declared
 
C:/Dev-Cpp/include/sql.h:402: error: `SQLPOINTER' has not been declared
In file included from sql.cpp:5:
C:/Dev-Cpp/include/sqlext.h:1184: error: `SQLHWND' has not been declared
C:/Dev-Cpp/include/sqlext.h:1184: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1184: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1184: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1185: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1185: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1186: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1186: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sqlext.h:1186: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1186: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1187: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1187: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1187: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1188: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1188: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1189: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1189: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1189: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1190: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1192: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1192: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1194: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1194: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1195: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1195: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1195: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1196: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1196: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1196: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sqlext.h:1196: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1197: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1197: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1197: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1198: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1198: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1198: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1199: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1199: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1199: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1200: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1200: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1200: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlext.h:1201: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1201: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlext.h:1201: error: `SQLPOINTER' has not been declared
 
C:/Dev-Cpp/include/sqlext.h:1202: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1202: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlext.h:1203: error: expected constructor, destructor, or type conversion before "ODBCGetTryWaitValue"
C:/Dev-Cpp/include/sqlext.h:1203: error: expected `,' or `;' before "ODBCGetTryWaitValue"
C:/Dev-Cpp/include/sqlext.h:1204: error: expected constructor, destructor, or type conversion before "ODBCSetTryWaitValue"
C:/Dev-Cpp/include/sqlext.h:1204: error: expected `,' or `;' before "ODBCSetTryWaitValue"
C:/Dev-Cpp/include/sqlext.h:1205: error: `LPWSTR' was not declared in this scope
C:/Dev-Cpp/include/sqlext.h:1205: error: `LPWSTR' was not declared in this scope
 
C:/Dev-Cpp/include/sqlext.h:1205: error: `DWORD' was not declared in this scope
C:/Dev-Cpp/include/sqlext.h:1205: error: initializer expression list treated as compound expression
C:/Dev-Cpp/include/sqlext.h:1207: error: expected constructor, destructor, or type conversion before "TraceReturn"
C:/Dev-Cpp/include/sqlext.h:1207: error: expected `,' or `;' before "TraceReturn"
C:/Dev-Cpp/include/sqlext.h:1208: error: expected constructor, destructor, or type conversion before "TraceVersion"
C:/Dev-Cpp/include/sqlext.h:1208: error: expected `,' or `;' before "TraceVersion"
In file included from C:/Dev-Cpp/include/sqlext.h:1214,
                 from sql.cpp:5:
C:/Dev-Cpp/include/sqlucode.h:22: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:22: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:24: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:24: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:25: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:25: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:25: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:25: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:26: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:26: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:26: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:27: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:27: error: `SQLUSMALLINT' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:27: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:28: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:28: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:28: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:28: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:30: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:30: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:30: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:30: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:32: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:32: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:32: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:34: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:34: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:34: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:35: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:36: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:36: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:36: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:37: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:37: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:38: error: `SQLHWND' has not been declared
C:/Dev-Cpp/include/sqlucode.h:38: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:38: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:38: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:39: error: `SQLHWND' has not been declared
C:/Dev-Cpp/include/sqlucode.h:39: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:40: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:40: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:40: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:41: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:42: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:42: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:44: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:46: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:48: error: `SQLPOINTER' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:49: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:50: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:50: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:51: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:51: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:52: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:54: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:54: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:55: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:55: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:58: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:58: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:60: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:62: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:62: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:62: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:64: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:64: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:64: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:64: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:66: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:66: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:66: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:68: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:69: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:70: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:70: error: `SQLUINTEGER' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:71: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:71: error: `SQLUINTEGER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:72: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLCHAR' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:74: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:75: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:75: error: `SQLUSMALLINT' has not been declared
 
C:/Dev-Cpp/include/sqlucode.h:75: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:76: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:77: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:77: error: `SQLUSMALLINT' has not been declared
C:/Dev-Cpp/include/sqlucode.h:78: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:78: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:78: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:80: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:80: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:80: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:80: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:83: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:84: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:85: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:86: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:87: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:89: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:90: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:91: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:91: error: `SQLCHAR' has not been declared
C:/Dev-Cpp/include/sqlucode.h:93: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:94: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:95: error: `SQLPOINTER' has not been declared
C:/Dev-Cpp/include/sqlucode.h:96: error: `SQLPOINTER' has not been declared
 
make.exe: *** [sql.o] Error 1
 
Execution terminated

Open in new window

0
 
jamied66Author Commented:
ah. the windows.h include needs to be called before the sql headers.
thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.