所以开始这段代码适用于我所有的红帽机器和其他一些solaris机器。产生故障的机器是solaris 64位。我的代码如下:为什么我在solaris上遇到这种分段错误?
这是frUUID类:
frUUID::frUUID()
{}
std::string frUUID::genUUID()
{
char uuidBuff[36];
uuid_t uuidGenerated;
uuid_generate_random(uuidGenerated);
uuid_unparse(uuidGenerated, uuidBuff);
std::cout << uuidBuff << std::endl; // prints out a correct uuid
return std::string(uuidBuff);
}
在单元测试
然后,我有:
frUUID uuids;
std::string uuid1 = uuids.genUUID();
std::cout << std::endl << "UUID 1: " << uuid1 << std::endl;
//This cout produces the seg fault on the uuid1
我不知道是怎么回事这里的一切似乎是正确的?有没有人有任何想法?
谢谢你,我的头在这转动了几个小时,我不能相信我错过了那个。 – Grammin