当前位置: 技术问答>linux和unix
嵌入C(sqC) 的编译,连接,环境,路径,make file 的问题; 您的一句话,我的几天功
来源: 互联网 发布时间:2015-07-31
本文导语: 我在进行db2嵌入C程序练习时,最见的例子都编译不过; 连个人也抓不着,好无助呀。。 万分感谢: db2 prep TT.sqC 后得到了,TT.C 然后编译连接: xlC -o test2 TT.C -L/insthome/db2inst1/sqllib/lib -ldb2 -I/insthome/db2inst1/sqlli...
我在进行db2嵌入C程序练习时,最见的例子都编译不过;
连个人也抓不着,好无助呀。。
万分感谢:
db2 prep TT.sqC
后得到了,TT.C
然后编译连接:
xlC -o test2 TT.C -L/insthome/db2inst1/sqllib/lib -ldb2 -I/insthome/db2inst1/sqllib/include
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
结果,没有报错;
但运行确报出:
[pbuser@bidev]:/dwbi/pbuser>$test2
exec(): 0509-036 Cannot load program test2 because of the following errors:
0509-022 Cannot load module /usr/opt/db2_08_01/lib/libdb2.a(shr.o).
0509-150 Dependent module /insthome/db2inst1/sqllib/lib/libdb2osse.a(s
hr.o) could not be loaded.
0509-152 Member shr.o is not found in archive
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
也就是说,我的DB2库没有连上,为什么呀??
我做了一个MakeFile
结果报错:
Target "all" is up to date.
makeFile:
DB2PATH = /insthome/db2inst1/sqllib
CC = xlC
CM = xlC_r7
HEADS = -I$(DB2PATH)/include
# The required libraries
LIBS = -L$(DB2PATH)/lib -ldb2
LIBSUDF = -L$(DB2PATH)/lib -ldb2 -ldb2apie
DB = ****
# Set UID and PWD if neccesary
UID=*****
PWD=*****
all: test4
test4: TT.sqC
db2 connect to $(DB) user $(UID) using $(PWD)
db2 prep TT.sqC
$(CC) -o test2 TT.C $(LIBS) $(HEADS)
----------------------------------------------------
高手救命,我都搞了好几天了,也不见效果
连个人也抓不着,好无助呀。。
万分感谢:
db2 prep TT.sqC
后得到了,TT.C
然后编译连接:
xlC -o test2 TT.C -L/insthome/db2inst1/sqllib/lib -ldb2 -I/insthome/db2inst1/sqllib/include
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
结果,没有报错;
但运行确报出:
[pbuser@bidev]:/dwbi/pbuser>$test2
exec(): 0509-036 Cannot load program test2 because of the following errors:
0509-022 Cannot load module /usr/opt/db2_08_01/lib/libdb2.a(shr.o).
0509-150 Dependent module /insthome/db2inst1/sqllib/lib/libdb2osse.a(s
hr.o) could not be loaded.
0509-152 Member shr.o is not found in archive
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
也就是说,我的DB2库没有连上,为什么呀??
我做了一个MakeFile
结果报错:
Target "all" is up to date.
makeFile:
DB2PATH = /insthome/db2inst1/sqllib
CC = xlC
CM = xlC_r7
HEADS = -I$(DB2PATH)/include
# The required libraries
LIBS = -L$(DB2PATH)/lib -ldb2
LIBSUDF = -L$(DB2PATH)/lib -ldb2 -ldb2apie
DB = ****
# Set UID and PWD if neccesary
UID=*****
PWD=*****
all: test4
test4: TT.sqC
db2 connect to $(DB) user $(UID) using $(PWD)
db2 prep TT.sqC
$(CC) -o test2 TT.C $(LIBS) $(HEADS)
----------------------------------------------------
高手救命,我都搞了好几天了,也不见效果
|
mark
|
把LIBS = -L$(DB2PATH)/lib -ldb2
改成LIBS = $(DB2PATH)/lib/libdb2.a试试,对于-l选项有些编译起默认连接动态库,要不看看环境变量LD_LIBRARY_PATH的值。
改成LIBS = $(DB2PATH)/lib/libdb2.a试试,对于-l选项有些编译起默认连接动态库,要不看看环境变量LD_LIBRARY_PATH的值。