当前位置: 技术问答>linux和unix
AIX Server下面ld C语言出警告 居然不能用%操作
来源: 互联网 发布时间:2016-01-21
本文导语: 简单的C程序 #include #include typedef struct _RandInfo { int iMin; int iMax; int iRand; } RandInfo; void JMYTSXZCRAND(RandInfo *rndInf) { int tmp, rnd, bas; printf("%dn",rndInf->iMin); printf("%dn",rndInf->iMax); ...
简单的C程序
#include
#include
typedef struct _RandInfo {
int iMin;
int iMax;
int iRand;
} RandInfo;
void JMYTSXZCRAND(RandInfo *rndInf)
{
int tmp, rnd, bas;
printf("%dn",rndInf->iMin);
printf("%dn",rndInf->iMax);
if (rndInf->iMax > rndInf->iMin)
{
printf("ifn");
tmp = (int)(((rndInf->iMax) + 1) - (rndInf->iMin));
printf("tmp=%dn",tmp);
rnd= rand();
printf("rnd=%dn",rnd);
bas = rnd % tmp; /* iRand = bas + (rndInf->iMin);
}
else
rndInf->iRand = rndInf->iMin;
}
使用下面的makefile编译链接,居然出Warning。
但是如果把取模操作注释掉就没事了。
难道是我的makefile里面没有找到c编译器关于取模操作的lib?
makefile:
libTESTC.a : test_c.o
/usr/bin/ld -o libTESTC.a -G -bexpall -bnoentry test_c.o
test_c.o : test_c.c
/usr/vac/bin/xlc -Aa -c -I/usr/include -I/opt/hitachicodecnv/include -I/include test_c.c -o test_c.o
编译错误:
/usr/vac/bin/xlc -Aa -c -I/usr/include -I/opt/hitachicodecnv/include -I/include test_c.c -o test_c.o
/usr/bin/ld -o libTESTC.a -G -bexpall -bnoentry test_c.o
ld: 0711-768 WARNING: Object test_c.o, section 1, function .__divss:
The branch at address 0xa8 is not followed by a recognized no-op
or TOC-reload instruction. The unrecognized instruction is 0x60850000.
/opt/HILNGcbl/bin/ccbl -d -C2 -P3 -T1 -T2 -T6 -Un -X5 -Mw test_cbl.cbl
/usr/vac/bin/xlc -o TESTCBL -bdynamic -brtl -blibpath: -L/usr/lib -lm -lc -lbsd -L/opt/HILNGcbl/lib -lcbl85 -lcb
l85ml -lcbl85cgi -L./ -lTESTC test_cbl.o
#include
#include
typedef struct _RandInfo {
int iMin;
int iMax;
int iRand;
} RandInfo;
void JMYTSXZCRAND(RandInfo *rndInf)
{
int tmp, rnd, bas;
printf("%dn",rndInf->iMin);
printf("%dn",rndInf->iMax);
if (rndInf->iMax > rndInf->iMin)
{
printf("ifn");
tmp = (int)(((rndInf->iMax) + 1) - (rndInf->iMin));
printf("tmp=%dn",tmp);
rnd= rand();
printf("rnd=%dn",rnd);
bas = rnd % tmp; /* iRand = bas + (rndInf->iMin);
}
else
rndInf->iRand = rndInf->iMin;
}
使用下面的makefile编译链接,居然出Warning。
但是如果把取模操作注释掉就没事了。
难道是我的makefile里面没有找到c编译器关于取模操作的lib?
makefile:
libTESTC.a : test_c.o
/usr/bin/ld -o libTESTC.a -G -bexpall -bnoentry test_c.o
test_c.o : test_c.c
/usr/vac/bin/xlc -Aa -c -I/usr/include -I/opt/hitachicodecnv/include -I/include test_c.c -o test_c.o
编译错误:
/usr/vac/bin/xlc -Aa -c -I/usr/include -I/opt/hitachicodecnv/include -I/include test_c.c -o test_c.o
/usr/bin/ld -o libTESTC.a -G -bexpall -bnoentry test_c.o
ld: 0711-768 WARNING: Object test_c.o, section 1, function .__divss:
The branch at address 0xa8 is not followed by a recognized no-op
or TOC-reload instruction. The unrecognized instruction is 0x60850000.
/opt/HILNGcbl/bin/ccbl -d -C2 -P3 -T1 -T2 -T6 -Un -X5 -Mw test_cbl.cbl
/usr/vac/bin/xlc -o TESTCBL -bdynamic -brtl -blibpath: -L/usr/lib -lm -lc -lbsd -L/opt/HILNGcbl/lib -lcbl85 -lcb
l85ml -lcbl85cgi -L./ -lTESTC test_cbl.o
|
不清楚那里的问题,应该不是"%"的问题,检查前面是不是有别的错误.
|
编译时加上如下的选项
-qprocimported=__divss
-qprocimported=__divss
|
路过
|
貌似 tmp 有肯能为 0;
|
还没有解决吗?