免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1189 | 回复: 0
打印 上一主题 下一主题

makefile问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-05-18 16:34 |只看该作者 |倒序浏览
下面这段程序我在linux下编译没问题,在solaris下编译总是不认识__((packed)); ,具体错误如下:

Syntax error at line 99, column 16, file AIthread.h:
Error at line 99, column 16 in file AIthread.h
}__attribute__((packed)) ;
...............1
PCC-S-02201, Encountered the symbol "(" when expecting one of the following:

   ) auto, char, const, double, enum, float, int, long,
   ulong_varchar, OCIBFileLocator OCIBlobLocator,
   OCIClobLocator, OCIDateTime, OCIExtProcContext, OCIInterval,
   OCIRowid, OCIDate, OCINumber, OCIRaw, OCIString, register,
   short, signed, sql_context, sql_cursor, static, struct,
   union, unsigned, utext, uvarchar, varchar, void, volatile,
   an identifier, a typedef name, exec oracle,
   exec oracle begin, exec, exec sql, exec sql begin,
   exec sql type, exec sql var,
The symbol "auto," was substituted for "(" to continue.

有没有高手给我提供一个makefile,或者帮我找找问题,我的makefile附后

  1. #include <stdlib.h>;
  2. #include <sys/ipc.h>;
  3. #include <stdio.h>;
  4. #include <string.h>;
  5. #include <fcntl.h>;
  6. #include <unistd.h>;
  7. #include <sys/types.h>;
  8. #include <sys/stat.h>;
  9. #include <sys/time.h>;
  10. #include <sys/socket.h>;
  11. #include <netinet/in.h>;
  12. #include <arpa/inet.h>;
  13. #include <pthread.h>;
  14. #include <sys/msg.h>;
  15. #include <netdb.h>;
  16. #include <errno.h>;
  17. #include <sys/ioctl.h>;

  18. #include <math.h>;
  19. #include <iconv.h>;
  20. #include    <ctype.h>;
  21. #include    <time.h>;
  22. #include    <sys/uio.h>;
  23. #include    <sys/wait.h>;
  24. #include    <sys/un.h>;
  25. #include    <limits.h>;
  26. #include    <unistd.h>;
  27. #include    <arpa/nameser.h>;
  28. #include    <resolv.h>;
  29. #include    <signal.h>;
  30. #include    <stdarg.h>;

  31. #include <sqlca.h>;
  32. #include <oraca.h>;
  33. #include <sqlda.h>;
  34. #include <sqlcpr.h>;

  35. struct  ai_packet
  36. {
  37.    uint8_t         fsuid[14];
  38.    uint32_t   head;
  39.    uint8_t      uptime[6];
  40.    uint8_t         cmd;   
  41. }__attribute__((packed));


  42. void initdb();

  43. main()
  44. {
  45.    struct  ai_packet asp;
  46.    printf("aip=%d\n  csp=%d\n",sizeof(aip));
  47.    initdb();
  48.    
  49.    printf("haha\n");
  50. }

  51. void initdb()
  52. {
  53.   EXEC  SQL  BEGIN  DECLARE     SECTION;
  54.        VARCHAR    username[20];
  55.        VARCHAR    password[20];
  56.        VARCHAR    db_name[20];
  57.   EXEC  SQL  END  DECLARE   SECTION;
  58.   
  59.   strcpy((char *)username.arr,"wyj");
  60.   username.len=strlen((char *)username.arr);
  61.   strcpy((char  *)password.arr,"wyj");
  62.   password.len=strlen((char *)password.arr);
  63.   strcpy((char *)db_name.arr,"bakkgl");   
  64.   db_name.len=strlen((char *)db_name.arr);
  65.   
  66.   EXEC SQL  CONNECT :username  IDENTIFIED  BY :password USING :db_name;
  67.   
  68.   if (sqlca.sqlcode!=0)
  69.   {
  70.       printf("sqlca.sqlcode=%d,fail to connect\n",sqlca.sqlcode);   
  71.       exit(0);
  72.   }
  73. }
复制代码


makefie内容:
  1. # make all


  2. PROC=$(ORACLE_HOME)/bin/proc
  3. PROFLAGS=ireclen=132 oreclen=132 select error=no sqlcheck=full userid=$(USERID)
  4. dbms=v8
  5. PROFLAGS=ireclen=132 oreclen=132  dbms=v8

  6. CPP=g++
  7. CC=cc  -g
  8. LD=ld
  9. CCFLAGS= -g
  10. CCFLAGS= -g
  11. CPPFLAGS=-g3
  12. INCDIR=-I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/rdbms/public -I$(ORACLE_HOME
  13. )/plsql/public -I$(ORACLE_HOME)/network/public -I$(ORACLE_HOME)/precomp/public
  14. LIBNAME=liboralib
  15. SOEXT=.so

  16. SOFLAGS=-shared -Wl,-expect unresolved -Wl,-soname,$(LIBNAME)$(SOEXT) $(LIBPATH)
  17. LDFLAGS=-shared -expect unresolved  * -soname

  18. # LIBPATH=-L/usr/local/oracle/product/8.0.5/lib -L/usr/local/oracle/product/8.0.
  19. 5/rdbms/lib
  20. LIBPATH=-L$(ORACLE_HOME)/lib -L$(ORACLE_HOME)/rdbms/lib

  21. LIBS=$(ORACLE_HOME)/rdbms/lib32/defopt.o $(ORACLE_HOME)/lib32/sscoreed.o $(ORACL
  22. E_HOME)/lib32/libclntsh.so $(ORACLE_HOME)/lib32/nautab.o $(ORACLE_HOME)/lib32/na
  23. eet.o $(ORACLE_HOME)/lib32/naect.o $(ORACLE_HOME)/lib32/naedhs.o $(ORALIBS)

  24. ORALIBSO= -lmm  -lnetv2 -lnttcp  -lnetwork -lncr -lclient -lvsn   -lepc
  25.           -lcommon -lgeneric  -lcore4   -lnlsrtl3 -lnsl -lm -ldl -lm  -lsql
  26.           -lsocket
  27. #ORALIBS= -lm -ldl  -lsocket

  28. ORALIBS=-lm -ldl  -lsocket  -lnsl  -lpthread -liconv

  29. CPPOBJECTS=orabase.o orastmt.o

  30. HEADER=orabase.h orastmt.h

  31. .SUFFIXES: .cc .c

  32. .c.o:
  33.         $(CC) $(CCFLAGS) $(INCDIR) -o $@ -c $<
  34. .cc.o:
  35.         $(CPP) $(CPPFLAGS) $(INCDIR) -o $@ -c $<

  36. lib: $(CPPOBJECTS) $(HEADERS)
  37.         $(CPP) $(CPPFLAGS) $(SOFLAGS) $(LIBPATH) -o $(LIBNAME)$(SOEXT) $(CPPOBJE
  38. CTS) $(LIBS)
  39. clean:
  40.         $(RM) *.o core *~ *.c

  41. distclean: clean
  42.         $(RM) $(LIBNAME)$(SOEXT) so locations

  43. #------------------------------------------------------
  44. # Change the following 5 lines for your needs

  45. all: AIthread.c  AIthread
  46. AIthread.c:     AIthread.pc ; -$(PROC) iname=$*.pc $(PROFLAGS)
  47. AIthread:       AIthread.o

复制代码


makefile中AIthread为程序名
谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP