Hi all,
I am having trouble in compiling the code written C language on windows platform.
The compiler throws error as below,
test.obj : error LNK2019: unresolved external symbol SQLDriverConnect@32 referenced in function _main test.exe : fatal error LNK1120: 1 unresolved externals
Source code:
Code:
#include <stdio.h>
#include <windows.h>
#include <winnt.h>
#include <sql.h>
#include <sqlext.h>
main() {
SQLRETURN ret;
SQLHDBC dbc; /* assume already allocated */
ret = SQLDriverConnect(dbc, NULL, "DSN=mydsn;", SQL_NTS,
NULL, 0, NULL, SQL_DRIVER_COMPLETE);
}
Compiler: VS 2010 command line
cl test.c
When I try to link the odbc with /link odbc switch in the command line it throws error. Basically, I am not able to find out as how to link odbc.
Could you anyone please help me out to compile successfully.
Do we have any step-by-step approch for ODBC connection from c language?
Thanks,
Sundar