- 论坛徽章:
- 0
|
下面这段程序我在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附后
- #include <stdlib.h>;
- #include <sys/ipc.h>;
- #include <stdio.h>;
- #include <string.h>;
- #include <fcntl.h>;
- #include <unistd.h>;
- #include <sys/types.h>;
- #include <sys/stat.h>;
- #include <sys/time.h>;
- #include <sys/socket.h>;
- #include <netinet/in.h>;
- #include <arpa/inet.h>;
- #include <pthread.h>;
- #include <sys/msg.h>;
- #include <netdb.h>;
- #include <errno.h>;
- #include <sys/ioctl.h>;
- #include <math.h>;
- #include <iconv.h>;
- #include <ctype.h>;
- #include <time.h>;
- #include <sys/uio.h>;
- #include <sys/wait.h>;
- #include <sys/un.h>;
- #include <limits.h>;
- #include <unistd.h>;
- #include <arpa/nameser.h>;
- #include <resolv.h>;
- #include <signal.h>;
- #include <stdarg.h>;
- #include <sqlca.h>;
- #include <oraca.h>;
- #include <sqlda.h>;
- #include <sqlcpr.h>;
- struct ai_packet
- {
- uint8_t fsuid[14];
- uint32_t head;
- uint8_t uptime[6];
- uint8_t cmd;
- }__attribute__((packed));
- void initdb();
- main()
- {
- struct ai_packet asp;
- printf("aip=%d\n csp=%d\n",sizeof(aip));
- initdb();
-
- printf("haha\n");
- }
- void initdb()
- {
- EXEC SQL BEGIN DECLARE SECTION;
- VARCHAR username[20];
- VARCHAR password[20];
- VARCHAR db_name[20];
- EXEC SQL END DECLARE SECTION;
-
- strcpy((char *)username.arr,"wyj");
- username.len=strlen((char *)username.arr);
- strcpy((char *)password.arr,"wyj");
- password.len=strlen((char *)password.arr);
- strcpy((char *)db_name.arr,"bakkgl");
- db_name.len=strlen((char *)db_name.arr);
-
- EXEC SQL CONNECT :username IDENTIFIED BY :password USING :db_name;
-
- if (sqlca.sqlcode!=0)
- {
- printf("sqlca.sqlcode=%d,fail to connect\n",sqlca.sqlcode);
- exit(0);
- }
- }
复制代码
makefie内容:
- # make all
- PROC=$(ORACLE_HOME)/bin/proc
- PROFLAGS=ireclen=132 oreclen=132 select error=no sqlcheck=full userid=$(USERID)
- dbms=v8
- PROFLAGS=ireclen=132 oreclen=132 dbms=v8
- CPP=g++
- CC=cc -g
- LD=ld
- CCFLAGS= -g
- CCFLAGS= -g
- CPPFLAGS=-g3
- INCDIR=-I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/rdbms/public -I$(ORACLE_HOME
- )/plsql/public -I$(ORACLE_HOME)/network/public -I$(ORACLE_HOME)/precomp/public
- LIBNAME=liboralib
- SOEXT=.so
- SOFLAGS=-shared -Wl,-expect unresolved -Wl,-soname,$(LIBNAME)$(SOEXT) $(LIBPATH)
- LDFLAGS=-shared -expect unresolved * -soname
- # LIBPATH=-L/usr/local/oracle/product/8.0.5/lib -L/usr/local/oracle/product/8.0.
- 5/rdbms/lib
- LIBPATH=-L$(ORACLE_HOME)/lib -L$(ORACLE_HOME)/rdbms/lib
- LIBS=$(ORACLE_HOME)/rdbms/lib32/defopt.o $(ORACLE_HOME)/lib32/sscoreed.o $(ORACL
- E_HOME)/lib32/libclntsh.so $(ORACLE_HOME)/lib32/nautab.o $(ORACLE_HOME)/lib32/na
- eet.o $(ORACLE_HOME)/lib32/naect.o $(ORACLE_HOME)/lib32/naedhs.o $(ORALIBS)
- ORALIBSO= -lmm -lnetv2 -lnttcp -lnetwork -lncr -lclient -lvsn -lepc
- -lcommon -lgeneric -lcore4 -lnlsrtl3 -lnsl -lm -ldl -lm -lsql
- -lsocket
- #ORALIBS= -lm -ldl -lsocket
- ORALIBS=-lm -ldl -lsocket -lnsl -lpthread -liconv
- CPPOBJECTS=orabase.o orastmt.o
- HEADER=orabase.h orastmt.h
- .SUFFIXES: .cc .c
- .c.o:
- $(CC) $(CCFLAGS) $(INCDIR) -o $@ -c $<
- .cc.o:
- $(CPP) $(CPPFLAGS) $(INCDIR) -o $@ -c $<
- lib: $(CPPOBJECTS) $(HEADERS)
- $(CPP) $(CPPFLAGS) $(SOFLAGS) $(LIBPATH) -o $(LIBNAME)$(SOEXT) $(CPPOBJE
- CTS) $(LIBS)
- clean:
- $(RM) *.o core *~ *.c
- distclean: clean
- $(RM) $(LIBNAME)$(SOEXT) so locations
- #------------------------------------------------------
- # Change the following 5 lines for your needs
- all: AIthread.c AIthread
- AIthread.c: AIthread.pc ; -$(PROC) iname=$*.pc $(PROFLAGS)
- AIthread: AIthread.o
复制代码
makefile中AIthread为程序名
谢谢 |
|