[unixODBC-dev] Urgent Help: undefined reference errors

Shwe Yee Than shweyeesyt at yahoo.com
Mon Mar 10 01:44:12 GMT 2008


Hello,
 
 I'm using unixODBC 2.2.12 and trying to compile the following program and got some errors.  I have been trying to solve this problem for about 2 weeks already. Can anyone help me?
 
 
#include <stdio.h>
#include "/usr/local/easysoft/unixODBC/include/sql.h"
#include "/usr/local/easysoft/unixODBC/include/sqlext.h"

main() {
  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");
  }
} 
 The compilation and the output is as follows:
 
 [root at fsktm src]$ gmake
 gcc -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DPORTNAME_linux -DPARA_OPR=1 -DFED_MCAT -DPORTNAME_linux -DFED_MCAT -I./include -I/home/srb/SRB3_4_2/src/include -I/home/srb/SRB3_4_2/src/catalog/include -I/home/srb/SRB3_4_2/utilities/include   -c -o alpha1.o alpha1.c
 gcc -c sample_main.c -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DPORTNAME_linux -DPARA_OPR=1 -DFED_MCAT -DPORTNAME_linux -DFED_MCAT -I./include -I/home/srb/SRB3_4_2/src/include -I/home/srb/SRB3_4_2/src/catalog/include -I/home/srb/SRB3_4_2/utilities/include
 gcc alpha1.o sample_main.o -o etd.cgi  /home/srb/SRB3_4_2/utilities/obj/srbClientUtil.o -L/home/srb/SRB3_4_2/obj -lSrbClient -lm -lpthread
 undefined reference to `SQLAllocHandle'
 undefined reference to `SQLSetEnvAttr'
 undefined reference to `SQLDrivers'
 collect2: ld returned 1 exit status
 gmake: *** [etd.cgi] Error 1
 
 Really appreciate for the helping hands.
 
 With Regards,
 SYT
 
       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-dev/attachments/20080309/dc644d6e/attachment.html>


More information about the unixODBC-dev mailing list