У меня есть фрагмент кода из Ubuntu, который генерирует случайный UUID:
#include <uuid.h>
std::string generateUuid()
{
uuid_t uuid;
uuid_generate(uuid);
char uuid_str[37];
uuid_unparse_lower(uuid, uuid_str);
std::string res(uuid_str);
return res;
}
Я бы хотел перенести этот код для centOS, но, к сожалению, он использует совершенно другую версию uuid, которая не распознает основные типы uuid из версии ubuntu, как это может быть показано из следующих ошибок:
error: aggregate ‘uuid_t uuid’ has an incomplete type and cannot be defined uuid_t uuid;
error: ‘uuid_generate’ was not declared in this scope uuid_generate(uuid);
error: ‘uuid_unparse_lower’ was not declared in this scope uuid_unparse_lower(uuid, uuid_str);
Интересно, каков синоним подхода для генерации uuid в библиотеке centOS uuid.
Вот описание библиотеки для каждой платформы
Ubuntu:
uuid - DCE compatible Universally Unique Identifier library
centOS
uuid - OSSP Universally Unique Identifier Command-Line Tool