发新话题
打印

【求助】Pro c编程需要那些头文件,请指点谢谢!

【求助】Pro c编程需要那些头文件,请指点谢谢!

Pro c编程需要那些头文件,我写完编译的时候提示了:
复制内容到剪贴板
代码:
o_test1.c:6: parse error before `SQL'
o_test1.c:6: warning: data definition has no type or storage class
o_test1.c:7: parse error before `SQL'
o_test1.c:7: warning: data definition has no type or storage class
o_test1.c:8: parse error before `username'
o_test1.c:8: warning: data definition has no type or storage class
o_test1.c:9: parse error before `password'
o_test1.c:9: warning: data definition has no type or storage class
o_test1.c:11: parse error before `student_name'
o_test1.c:11: warning: data definition has no type or storage class
o_test1.c:12: parse error before `sex'
o_test1.c:12: warning: data definition has no type or storage class
o_test1.c:14: parse error before `location'
o_test1.c:14: warning: data definition has no type or storage class
o_test1.c:15: parse error before `SQL'
o_test1.c:15: syntax error before `bitmap'
o_test1.c:15: warning: data definition has no type or storage class
o_test1.c:17: parse error before `SQL'
o_test1.c:17: warning: data definition has no type or storage class
o_test1.c:18: parse error before `SQL'
o_test1.c:18: warning: data definition has no type or storage class
o_test1.c: In function `main':
o_test1.c:26: `EXEC' undeclared (first use in this function)
o_test1.c:26: (Each undeclared identifier is reported only once
o_test1.c:26: for each function it appears in.)
o_test1.c:26: parse error before `SQL'
o_test1.c:28: parse error before `SQL'
o_test1.c:31: warning: passing arg 1 of `strcpy' from incompatible pointer type
o_test1.c:32: warning: passing arg 1 of `strcpy' from incompatible pointer type
o_test1.c:33: parse error before `SQL'
o_test1.c:35: parse error before `)'
o_test1.c:45: parse error before `SQL'
o_test1.c:49: parse error before `SQL'
o_test1.c: In function `sqlerror':
o_test1.c:54: `EXEC' undeclared (first use in this function)
o_test1.c:54: parse error before `SQL'
o_test1.c:56: request for member `sqlerrm' in something not a structure or union
o_test1.c:57: parse error before `SQL'
是缺少头文件吗?      

TOP

现在找到原因了,要连接ORACLE的库,然后编译
贴上MAKEFILE 大家参考
复制内容到剪贴板
代码:
include $(ORACLE_HOME)/precomp/lib/env_precomp.mk
OBJS=o_test1.o
EXE=tt1
CC=gcc
MYCFLAGS=-g -D_DEBUG
FLAGPROC=userid=scott/tiger@test sqlcheck=full
PROCFLAGS=sys_include=(/usr/include,/usr/lib/gcc-lib/i486-suse-linux/2.95.3/include,/usr/lib/gcc-lib/i386-redhat-linux/2.96/include,/usr/lib/i386-redhat-linux7/include,/usr/lib/gcc-lib/i386-redhat-linux/3.2.3/include,/precomp/public)
THREADS=YES
RARSE=NONE
LIBS=-lclntsh
all:$(OBJS)
        $(CC) -o $(SQLCHECK) $(EXE) $(OBJS) $(LIBS) $(LDPATHFLAG) $(LIBHOME) $(PROLDLIBS)
        rm -f *.o *.c
.SUFFIXES: .pc .c .o
.pc.c:
        $(PROC) $(FLAGPROC) $(PROCFLAGS) iname=$ o_test1.pc

.pc.o:
        $(PROC) $(PROCFLAGS) iname=$ o_test1.pc
        $(CC) $(MYCFLAGS) -c $(LDPATHFLAG) $(LIBHOME) $(LIBS) $ o_test1.c

.c.o:
        $(CC) $(MYCFLAGS) -c $ o_test1.c
"FLAGPROC="要根据自己的实际ORACLE安装地址编写      

TOP

发新话题