2009-07-06 61 views
32

我试图替换对:: CoCreateGUID的调用,所以我可以在Linux上的C++程序中生成GUID。如何获取/使用LibUUID?

我知道libuuid支持这个,我读了this question

我有点新的Ubuntu的/ GCC/Linux的,所以我已经开始了这样的:

#include <uuid/uuid.h> 

现在我卡住了:) G ++找不到uuid.h,和我我不确定如何找到它。

+0

要展开的话题,在Gentoo:*搜索/usr/include/uuid/uuid.h .. (/usr/include/uuid/uuid.h) – 2010-12-26 15:33:05

+3

另外值得注意的是,在当前的Linux内核上,你可以通过读取/ proc/sys/kernel /随机/ uuid – Josef 2013-04-05 15:47:53

回答

55

在Ubuntu中,您可以做apt-cache search libuuid以查看与文本libuuid相关的可用包。这是我从Ubuntu 9.04的输出:

$ apt-cache search libuuid 
libuuid-perl - Perl extension for using UUID interfaces as defined in e2fsprogs 
libuuid1 - universally unique id library 
libuuid1-dbg - Debugging information for libuuid1 
uuid-dev - universally unique id library - headers and static libraries 
uuid-runtime - universally unique id library 
libuuidm-ocaml-dev - Universally unique identifiers for OCaml 

所以我认为你想要的是uuid-dev,并且可能是uuid-runtime。执行命令sudo apt-get install uuid-dev,它应该安装您需要移动的标题和库,以解决您遇到的问题。

+4

thx,看起来像我失踪了,我跑这个:“apt-get install uuid-dev”,并解决了我的问题。 – 2009-07-07 00:03:49