DEV C++连接数据库遇到的问题及解决方案

在网上找了一段用C语言连接SQL数据库的程序,在DEV C++中编译后出现以下问题:

[Linker error] undefined reference to `SQLAllocEnv@4'

  [Linker error] undefined reference to `SQLAllocConnect@8'

  [Linker error] undefined reference to `SQLSetConnectOption@12'

  [Linker error] undefined reference to `SQLConnect@28'

  [Linker error] undefined reference to `SQLAllocStmt@8'

  [Linker error] undefined reference to `SQLExecDirect@12'

  [Linker error] undefined reference to `SQLBindCol@24'

  [Linker error] undefined reference to `SQLFetch@4'

  [Linker error] undefined reference to `SQLCloseCursor@4'

  [Linker error] undefined reference to `SQLDisconnect@4'

  [Linker error] undefined reference to `SQLFreeConnect@4'

  [Linker error] undefined reference to `SQLFreeEnv@4'

  ld returned 1 exit status

 G:\vc6\h.c\Makefile.win [Build Error]  [工程3.exe] Error 1

 

运行时弹出以下对话框:工程未编译!

 

解决方案:

在工程属性中选择“参数”这一项,然后再连接器下方选择“加入库或者对象”,在安装根目录中lib文件夹中选择libodbc32.a,确定。重新编译运行可得到正确结果。

你可能感兴趣的:(数据库,c++,linker,reference,build,语言)