请教一个pro*c程序的问题,编译成可执行程序报错
[hwt@localhost proc]$ cat 1.pc程序代码:
#include<stdio.h> EXEC SQL BEGIN DECLARE SECTION; char username[20]; char password[20]; char last_name[25]; EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE sqlca; main() { EXEC SQL WHENEVER SQLERROR DO sqlerror(); strcpy(username,"viewdb"); strcpy(password, "viewdb"); EXEC SQL CONNECT:username IDENTIFIED BY:password; EXEC SQL select "1234" into :last_name from dual ; printf("\nID=2,last_name=%s\n" , last_name); }
[hwt@localhost proc]$ proc iname=1.pc oname=1.c parse=full
Pro*C/C++: Release 10.2.0.1.0 - Production on 星期六 4月 16 05:31:04 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
系统默认选项值取自于: /opt/app/oracle/product/10.2.0/db_1/precomp/admin/pcscfg.cfg
[hwt@localhost proc]$ cc -o 1 1.c
/tmp/ccAoBhfX.o(.text+0x1f9): In function `main':
: undefined reference to `sqlcxt'
/tmp/ccAoBhfX.o(.text+0x20a): In function `main':
: undefined reference to `sqlerror'
/tmp/ccAoBhfX.o(.text+0x37b): In function `main':
: undefined reference to `sqlcxt'
/tmp/ccAoBhfX.o(.text+0x38c): In function `main':
: undefined reference to `sqlerror'
collect2: ld returned 1 exit status
[hwt@localhost proc]$ env
HOSTNAME=localhost
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
NLS_LANG=Simplified Chinese_CHINA.ZHS16GBK
SSH_CLIENT=::ffff:192.168.187.1 49355 22
ORACLE_DOC=/opt/app/oracle/product/10.2.0/db_1/doc
QTDIR=/usr/lib/qt-3.3
SSH_TTY=/dev/pts/0
USER=hwt
COBCPY=:/cobinclude
LD_LIBRARY_PATH=/lib:/opt/app/oracle/product/10.2.0/db_1/lib:/opt/app/oracle/product/10.2.0/db_1/ctx/lib:/opt/app/oracle/product/10.2.0/db_1/jdbc/lib
LS_COLORS=no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:
ORACLE_SID=testdb
ORACLE_BASE=/opt/app/oracle
LIBPATH=/lib:
MAIL=/var/spool/mail/hwt
PATH=/bin:/usr/lib/jdk/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/hwt/bin:/opt/app/oracle/product/10.2.0/db_1/bin:/home/hwt/bin
INPUTRC=/etc/inputrc
PWD=/home/hwt/proc
JAVA_HOME=/usr/lib/jdk
COBOPT=-C ANS85 -C ALIGN=8 -C NOIBMCOMP -C TRUNC=ANSI -C OSEXT=cbl
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SHLVL=1
HOME=/home/hwt
LANGUAGE=zh_CN.GB18030:zh_CN.GB2312:zh_CN
LOGNAME=hwt
CLASSPATH=/opt/app/oracle/product/10.2.0/db_1/jre:/opt/app/oracle/product/10.2.0/db_1/JRE:/opt/app/oracle/product/10.2.0/db_1/jlib:/opt/app/oracle/product/10.2.0/db_1/rdbms/jlib:/opt/app/oracle/product/10.2.0/db_1/jdbc/lib/classes12.jar:/opt/app/oracle/product/10.2.0/db_1/jdbc/lib/nls_charset12.jar
SSH_CONNECTION=::ffff:192.168.187.1 49355 ::ffff:192.168.187.4 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
SHLIB_PATH=/lib:
ORA_NLS33=/opt/app/oracle/product/10.2.0/db_1/ocommon/nls/admin/data
ORACLE_HOME=/opt/app/oracle/product/10.2.0/db_1
G_BROKEN_FILENAMES=1
_=/bin/env
OLDPWD=/home/hwt