- 论坛徽章:
- 0
|
您好!PRO*C为什么我只要加<pthread.h>就报错,测试程序当然没有问题,我想用多线程的PRO*C。请问怎样改MAKEFILE(已经加了THREADS=YES),我用的OS是AIX,不用pro*c,能支持多线程。
程序如下:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sqlca.h>
/*#include <pthread.h>*/
#include "lib1.h"
void sql_error(char *msg);
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR username[30];
VARCHAR password[30];
EXEC SQL END DECLARE SECTION;
int main(int argc, char **argv)
{
Print("333333333333333333333333\n");
strncpy((char *) username.arr, "gdianu01", strlen("gdianu01"));
username.len = (unsigned short) strlen((char *)username.arr);
strncpy((char *) password.arr, "964218", strlen("964218"));
password.len = (unsigned short) strlen((char *)password.arr);
EXEC SQL WHENEVER SQLERROR DO sql_error("ORACLE error--\n");
EXEC SQL CONNECT :username IDENTIFIED BY :password;
EXEC SQL WHENEVER SQLERROR DO sql_error("insert--\n");
EXEC SQL INSERT INTO user_info VALUES('1111', '2222');
EXEC SQL ROLLBACK WORK RELEASE;
printf("connect suceccss\n");
exit(0);
}
void sql_error(char *msg)
{
EXEC SQL WHENEVER SQLERROR CONTINUE;
if (sqlca.sqlcode < 0)
printf("\n%.*s\n\n",sqlca.sqlerrm.sqlerrml,sqlca.sqlerrm.sqlerrmc);
printf("oracle error:%s\n", msg);
EXEC SQL ROLLBACK WORK RELEASE;
exit(-1);
}
错误如下:
$ make all
proc sqlcheck=full userid=gdianu01/964218 iname=/app/gdian/test/src/pre.pc include=/app/gdian/test/include
Pro*C/C++: Release 9.2.0.1.0 - Production on Sat Feb 3 12:40:12 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
System default option values taken from: /oracle9/OraHome/precomp/admin/pcscfg.cfg
Parser error at line 689, column 32, file /usr/include/sys/thread.h:
Error at line 689, column 32 in file /usr/include/sys/thread.h
sigset_t sigmask;
...............................1
PCC-F-02209, Macro invocation has incorrect number of arguments
Syntax error at line 689, column 25, file /usr/include/sys/thread.h:
Error at line 689, column 25 in file /usr/include/sys/thread.h
sigset_t sigmask;
........................1
PCC-S-02201, Encountered the symbol "1" when expecting one of the following:
( * an identifier,
Syntax error at line 689, column 25, file /usr/include/sys/thread.h:
Error at line 689, column 25 in file /usr/include/sys/thread.h
sigset_t sigmask;
........................1
PCC-S-02201, Encountered the symbol ")" when expecting one of the following:
; , ( [ * ? | & < > + - / % . ^ | & == != <= >= << >> ++ --
->
The symbol "(" was substituted for ")" to continue.
Syntax error at line 18, column 1, file /app/gdian/test/src/pre.pc:
Error at line 18, column 1 in file /app/gdian/test/src/pre.pc
{
1
PCC-S-02201, Encountered the symbol "{" when expecting one of the following:
; , = ( [
The symbol ";" was substituted for "{" to continue.
Syntax error at line 40, column 1, file /app/gdian/test/src/pre.pc:
Error at line 40, column 1 in file /app/gdian/test/src/pre.pc
{
1
PCC-S-02201, Encountered the symbol "{" when expecting one of the following:
; , = ( [
The symbol ";" was substituted for "{" to continue.
Syntax error at line 0, column 0, file /app/gdian/test/src/pre.pc:
Error at line 0, column 0 in file /app/gdian/test/src/pre.pc
PCC-S-02201, Encountered the symbol "<eof>" when expecting one of the following:
; { } ( * & + - ~ ! ^ ++ -- ... auto, break, case, char,
const, continue, default, do, double, enum, extern, float,
for, goto, if, int, long, ulong_varchar, OCIBFileLocator
OCIBlobLocator, OCIClobLocator, OCIDateTime,
OCIExtProcContext, OCIInterval, OCIRowid, OCIDate, OCINumber,
OCIRaw, OCIString, register, return, short, signed, sizeof,
sql_context, sql_cursor, static, struct, switch, typedef,
union, unsigned, utext, uvarchar, varchar, void, volatile,
while, an identifier, a typedef name, a precompiled header,
a quoted string, a numeric constant, exec oracle,
exec oracle begin, exec, exec sql, exec sql begin,
exec sql type, exec sql var, exec sql include,
Error at line 0, column 0 in file /app/gdian/test/src/pre.pc
PCC-F-02102, Fatal error while doing C preprocessing
make: 1254-004 The error code from the last command is 1.
Stop. |
|