how to config Pro*C !!!! help me!!

山尖美色 2003-01-15 04:23:41
I have question about pro*c compilation: We have recently installed a Pro*c compiler on HP UNIX 11 box and Oracle 8i. I modified a sample proc program to connect to our database and select several records from a table to verify the pro*c compiler works. Here is how I attempted to compiler the program:
> proc c_test.pc
Result:
Pro*C/C++: Release 8.1.7.0.0 - Production on Fri Dec 7 16:03:41 2001

(c) Copyright 2000 Oracle Corporation. All rights reserved.

System default option values taken from: /u01/app/oracle/product/8.1.7/precomp/a
dmin/pcscfg.cfg


pcscfg.cfg setting are:
sys_include=(/usr/include)
include=(/project/hpux/817/src_000811/precomp/public)
include=/project/hpux/817/src_000811/precomp/hdrs
include=/project/hpux/817/src_000811/tpcc2x_2/src
include=/project/hpux/817/src_000811/precomp/include
include=/project/hpux/817/src_000811/oracore/include
include=/project/hpux/817/src_000811/oracore/public
include=/project/hpux/817/src_000811/rdbms/include
include=/project/hpux/817/src_000811/rdbms/public
include=/project/hpux/817/src_000811/rdbms/demo
include=/project/hpux/817/src_000811/nlsrtl/include
include=/project/hpux/817/src_000811/nlsrtl/public
include=/project/hpux/817/src_000811/network_src/include
include=/project/hpux/817/src_000811/network_src/public
include=/project/hpux/817/src_000811/network/include
include=/project/hpux/817/src_000811/network/public
include=/project/hpux/817/src_000811/plsql/public
include=/project/hpux/817/src_000811/otrace/public
ltype=short

-----------------------------------------------------------------
Why do I get this message "System default option values taken from: /u01/app/oracle/product/8.1.7/precomp/a
dmin/pcscfg.cfg"? Also two other files generated: c_test.c and c_test.lis which should be fine.

So, I compiled the c_test.c program and here is an error message:
> cc c_tesc c

Error message:
cpp: "c_test.c", line 142: error 4036: Can't open include file 'sqlca.h'.

The sqlca.h file is located:
./u01/app/oracle/product/8.1.7/precomp/public/sqlca.h

The stdio.h and other *.h files located:
/usr/include

-------------------------------------------------------------
I have tried to include the sqlca.h file in the psscfg.cfg file, but it doesn't help much. Do I need to set a link in the /usr/include directory to the ./u01/app/oracle/product/8.1.7/precomp/public/ so it recognizes the sqlca.h and others *.h file in this directory? I am a beginner in Proc, please help.

Thank you very much,
Cindy

P.S. Here is the c_test.pc:
===================================================================
#include
#include

#define PWD_LEN 40

typedef char asciiz[PWD_LEN];

EXEC SQL TYPE asciiz IS STRING(PWD_LEN) REFERENCE;
asciiz username;
asciiz password;

struct apps_info
{
asciiz apps_login;
asciiz apps_name;
int apps_sch_ver;
};

void sql_error();

main()
{

struct apps_info *apps_rec_ptr;

if ((apps_rec_ptr =
(struct apps_info *) malloc(sizeof(struct apps_info))) == 0)
{
fprintf(stderr, "Memory allocation error. \n");
exit(1);
}

/* Connect to Oracle. */
strcpy(username, "scott");
strcpy(password, "trigger");


EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--");

EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username);

EXEC SQL DECLARE appsinfo_tbl CURSOR FOR
SELECT apps_login, apps_name, apps_sch_ver
FROM apps_info_tbl
WHERE rownum < 11;

EXEC SQL OPEN appsinfo_tbl;

printf("\n\n Application login are-- \n\n");
printf("Apps_login Apps_name Apps_sch_ver\n");
printf("----------- --------------- ------------\n");

EXEC SQL WHENEVER NOT FOUND DO break;

for(;;)
{
EXEC SQL FETCH appsinfo_tbl INTO :apps_rec_ptr;
printf("%-11s %-15s %14d", apps_rec_ptr->apps_login,
apps_rec_ptr->apps_name, apps_rec_ptr->apps_sch_ver);
}

EXEC SQL CLOSE appsinfo_tbl;

EXEC SQL COMMIT WORK RELEASE;
exit(0);
}

...全文
64 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
山尖美色 2003-01-15
  • 打赏
  • 举报
回复
make -f demo_proc.mk OBJS="e.o" EXE=e.e bulid
是这样吗?
山尖美色 2003-01-15
  • 打赏
  • 举报
回复
上面的兄弟!能不能给我说得清楚些!谢谢了
jettli 2003-01-15
  • 打赏
  • 举报
回复
up
三杯倒 2003-01-15
  • 打赏
  • 举报
回复
cc需要写.make文件
在相关目录下可以找到

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧