[英]Can a C++11 program use BlueZ?
I am having trouble compiling a simple C++11 program using the BlueZ library : 我在使用BlueZ库编译简单的C ++ 11程序时遇到了麻烦:
#include <bluetooth/bluetooth.h>
int main() {}
Compiling this with g++ -std=c++11 main.cpp
on my Fedora 21 box gives : 在我的Fedora 21盒子上使用
g++ -std=c++11 main.cpp
进行编译可以得到:
In file included from ../scale.cpp:1:0:
/usr/include/bluetooth/bluetooth.h: In function ‘uint64_t bt_get_le64(const void*)’:
/usr/include/bluetooth/bluetooth.h:177:9: error: expected identifier before ‘*’ token
return bt_get_unaligned((const uint64_t *) ptr);
^
...
This is with BlueZ version 5.23 and GCC 4.9.2. 这是与BlueZ版本5.23和GCC 4.9.2一起使用的。 Everything works if I remove the
-std=c++11
flag. 如果删除
-std=c++11
标志,一切正常。
Is this normal? 这正常吗?
By default GCC compiles to C++03 with GNU extensions. 默认情况下,GCC编译为具有GNU扩展名的C ++ 03。 If you specify
-std=C++11
then it compiles to ISO C++11 with no extensions enabled. 如果指定
-std=C++11
则它将编译为ISO C ++ 11,且未启用任何扩展名。 However if you specify -std=gnu++11
instead then you also get the GNU extensions. 但是,如果您指定
-std=gnu++11
那么您还将获得GNU扩展。
bluetooth.h中存在一个问题,只需用__typeof__
替换typeof
__typeof__
解决,这是一个参考: http : __typeof__
? ID = cf52a40302d0d20ccca22a7a1f53e46ef8abfca8
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.