免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1701 | 回复: 1

.pc文件编译,包含其他文件就出错 来看看啊 大虾 [复制链接]

论坛徽章:
0
发表于 2012-02-15 17:54 |显示全部楼层
文件部署src/yang_db_drv.pc
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>

  4. #include "yang_const_define.h"
  5. #include "yang_struct_define.h"

  6. EXEC SQL BEGIN DECLARE SECTION;
  7.         VARCHAR username[20];
  8.         VARCHAR password[20];
  9. EXEC SQL END DECLARE SECTION;

  10. EXEC SQL INCLUDE sqlca;

  11. DB_RETCD
  12. yang_db_init(char *user , char *pwd )
  13. {
  14.        
  15.         strcpy( username.arr , user );
  16.         username.len = strlen( username.arr );
  17.         strcpy( password.arr , pwd );
  18.         password.len = strlen( password.arr );

  19.         EXEC SQL CONNECT :username IDENTIFIED BY :password;

  20.         if(sqlca.sqlcode != 0)
  21.                 return DB_FAILURE;
  22.         return DB_SUCCESS;
  23. }

  24. void
  25. yang_db_exit()
  26. {
  27.         EXEC SQL COMMIT WORK RELEASE;
  28. }

  29. DB_RETCD
  30. yang_db_insert(SFTP_FILE_LOG *p_sftp_file_log)
  31. {
  32.         return DB_SUCCESS;
  33. }

  34. DB_RETCD
  35. yang_db_select(SFTP_FILE_LOG *p_sftp_file_log , int mode )
  36. {
  37.         return DB_SUCCESS;
  38. }

  39. DB_RETCD
  40. yang_db_update(SFTP_FILE_LOG *p_sftp_file_log , int mode )
  41. {
  42.         return DB_SUCCESS;
  43. }

  44. DB_RETCD
  45. yang_db_delete(SFTP_FILE_LOG *p_sftp_file_log , int mode)
  46. {
  47.         return DB_SUCCESS;
  48. }
复制代码
文件部署include/yang_const_define.h
  1. #ifndef _YANG_CONST_DEFINE_H
  2. #define _YANG_CONST_DEFINE_H

  3. #define DB_SUCCESS 0
  4. #define DB_FAILURE 1
  5. #define DB_FATAL 2

  6. #define SUCCESS 0
  7. #define FAILURE 1
  8. #define FATAL 2

  9. #define DB_RETCD unsigned int

  10. #define RETCD unsigned int

  11. #endif
复制代码
文件部署include/yang_struct_define.h
[code#ifndef _YANG_STRUCT_DEFINE_H
#define _YANG_STRUCT_DEFINE_H
typedef struct
{
        char s_file_name[150+1];
        char s_txn_date[8+1];
        char s_file_type[6+1];
        char c_io_flag;
        char s_member_id[12+1];
        char s_member_type[2+1];
        char s_cre_date_time[10+1];
        char s_rcv_date_time[10+1];
        char s_snd_date_time[10+1];
        char s_server_pid[8+1];
        char s_client_pid[8+1];
        char s_rcv_pkg[4+1];
        char c_status;
        char s_ret_cd[8+1];
}
        SFTP_FILE_LOG;
       
#endif[/code]

src名录下 执行 proc yang_db_drv.pc
错误如下:
================================================
[AIX:/si/usr/yangj/efss2dev/workspace/src]proc yang_db_drv.pc

Pro*C/C++: Release 10.2.0.3.0 - Production on Wed Feb 15 17:15:55 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

System default option values taken from: /home2/oracle/app/oracle/product/10.2.0/precomp/admin/pcscfg.cfg

Syntax error at line 14, column 1, file yang_db_drv.pc:
Error at line 14, column 1 in file yang_db_drv.pc
yang_db_init(char *user , char *pwd )
1
PCC-S-02201, Encountered the symbol "yang_db_init" when expecting one of the fol
lowing:

   ; , = ( [
The symbol ";" was substituted for "yang_db_init" to continue.

Syntax error at line 36, column 1, file yang_db_drv.pc:
Error at line 36, column 1 in file yang_db_drv.pc
yang_db_insert(SFTP_FILE_LOG *p_sftp_file_log)
1
PCC-S-02201, Encountered the symbol "yang_db_insert" when expecting one of the f
ollowing:

   ; , = ( [
The symbol "=" was substituted for "yang_db_insert" to continue.

Syntax error at line 37, column 1, file yang_db_drv.pc:
Error at line 37, column 1 in file yang_db_drv.pc
{
1
PCC-S-02201, Encountered the symbol "{" when expecting one of the following:

   ; , = ( [ * ? | & < > + - / % . ^ *= /= %= += -= <<= >>= &&=
   ||= ^= | & == != <= >= << >> ++ -- ->

Syntax error at line 42, column 1, file yang_db_drv.pc:
Error at line 42, column 1 in file yang_db_drv.pc
yang_db_select(SFTP_FILE_LOG *p_sftp_file_log , int mode )
1
PCC-S-02201, Encountered the symbol "yang_db_select" when expecting one of the f
ollowing:

   ; , = : ( [ * ? | & < > + - / % . ^ *= /= %= += -= <<= >>=
   &&= ||= ^= | & == != <= >= << >> ++ -- ->
The symbol ";" was substituted for "yang_db_select" to continue.

Syntax error at line 42, column 53, file yang_db_drv.pc:
Error at line 42, column 53 in file yang_db_drv.pc
yang_db_select(SFTP_FILE_LOG *p_sftp_file_log , int mode )
....................................................1
PCC-S-02201, Encountered the symbol "mode" when expecting one of the following:

   , ( ) [ * const, long, short, signed, unsigned, volatile,

Syntax error at line 0, column 0, file yang_db_drv.pc:
Error at line 0, column 0 in file yang_db_drv.pc
PCC-S-02201, Encountered the symbol "<eof>" when expecting one of the following:

   ; : an identifier, end-exec, random_terminal

Error at line 0, column 0 in file yang_db_drv.pc
PCC-F-02102, Fatal error while doing C preprocessing
====================================================
怎么包含编译成功?
/src
     yang_test_ctl.c                   //主函数目录(测试各种操作)
     yang_db_drv.pc                  //操作数据库函数
/include
     yang_const_define.h            //常量定义   
     yang_function_define.h        //函数宏定义
     yang_struct_define.h           //结构体定义
     yang_test_ctl.h                   //主函数头文件
     yang_db_drv.h                   //oracle仿驱动头文件
   
如何生成可执行文件?  帮写个简单的makefile 或者 让pc成功变成.c也行  多谢大虾 请高手教导 指条明路

论坛徽章:
0
发表于 2012-02-16 09:06 |显示全部楼层
就没人能解决吗
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP