printf("\nConnected to ORACLE as user: %s\n", username.arr);
EXEC SQL SELECT userid, passwd FROM TFI_USER; EXEC SQL COMMIT WORK RELEASE; } 错误代码: /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start': /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main' /tmp/ccXGCQnP.o: In function `Main': /tmp/ccXGCQnP.o(.text+0x217): undefined reference to `sqlcxt' /tmp/ccXGCQnP.o(.text+0x2a8): undefined reference to `sqlcxt' /tmp/ccXGCQnP.o(.text+0x326): undefined reference to `sqlcxt' collect2: ld returned 1 exit status
还有就是oraclehome下面的例子放在哪里啊,我怎么找不到呢
原代码:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>#define UNAME_LEN 20
#define PWD_LEN 40EXEC SQL BEGIN DECLARE SECTION;
VARCHAR username[UNAME_LEN];
VARCHAR password[PWD_LEN];
EXEC SQL END DECLARE SECTION;EXEC SQL INCLUDE SQLCA;Main()
{
strncpy((char *) username.arr, "phpdeveloper", UNAME_LEN);
username.len = (unsigned short) strlen((char *) username.arr);
strncpy((char *) password.arr, "111111", PWD_LEN);
password.len = (unsigned short) strlen((char *) password.arr); EXEC SQL CONNECT :username IDENTIFIED BY :password;
printf("\nConnected to ORACLE as user: %s\n", username.arr);
EXEC SQL SELECT userid, passwd FROM TFI_USER; EXEC SQL COMMIT WORK RELEASE;
}
错误代码:
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o: In function `_start':
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o(.text+0x18): undefined reference to `main'
/tmp/ccXGCQnP.o: In function `Main':
/tmp/ccXGCQnP.o(.text+0x217): undefined reference to `sqlcxt'
/tmp/ccXGCQnP.o(.text+0x2a8): undefined reference to `sqlcxt'
/tmp/ccXGCQnP.o(.text+0x326): undefined reference to `sqlcxt'
collect2: ld returned 1 exit status
gcc -g -L$(ORACLE_HOME)/lib -lclntsh main.o DbApi.o -o main.e
main.o : main.c
gcc -g -c main.c
DbApi.o : DbApi.c
gcc -g -I$(ORACLE_HOME)/precomp/public -I$(ORACLE_HOME)/rdbms/public -I$(ORACLE_HOME)/rdbms/demo -I$(ORACLE_HOME)/plsql/public -c DbApi.c # These macro definitions fill in some details or override some defaults
PROCPLSFLAGS= UNSAFE_NULL=YES MODE=ORACLE DBMS=V8 sqlcheck=full userid=$(USERID)
PROCPPFLAGS= code=cpp $(CPLUS_SYS_INCLUDE)
USERID=gprs/gprs@orcl
NETWORKHOME=$(ORACLE_HOME)/network/
PLSQLHOME=$(ORACLE_HOME)/plsql/