但是test1.cpp的编译报错。test1.cpp的编译命令为:
aCC ./test1.cpp -o ./test1 -L. -ldbclass -ldbopr
错误信息:
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (test1.o) was detect.
/usr/ccs/bin/ld: ./libmbdbopr.sl: Not a valid library (invalid magic number). P.
*** Error exit code 1
改用如下编译命令:
aCC ./test1.cpp -o ./test1 -L. -ldbclass
错误信息变为:
Error 419: \"./test1.cpp\", line 19 # \'CTable1\' is used as a type, but has
not been defined as a type.
CTable1 Object;
^^^^^^^^^^^^^
Error 186: \"./test1.cpp\", line 31 # Left side of \'.\' requires a class object;
type found was \'int\'.
Object.InsRecord(&record);
^^^^^^
Error 328: \"./test1.cpp\", line 67 # Function \'DBLinkOperate\' has not been
defined yet; cannot call.
iReturnCode=DBLinkOperate(DB_COMMIT);
^^^^^^^^^^^^^
类CTable1封装在libdbclass.sl 中,函数DBLinkOperate封装在库libdbopr.sl 中。