C ++ 11程序可以使用BlueZ吗? [英] Can a C++11 program use BlueZ?
问题描述
我无法使用BlueZ库编译简单的C ++ 11程序:
I am having trouble compiling a simple C++11 program using the BlueZ library :
#include <bluetooth/bluetooth.h>
int main() {}
在我的Fedora 21盒中使用 g ++ -std = c ++ 11 main.cpp
进行编译,即可得出:
Compiling this with g++ -std=c++11 main.cpp
on my Fedora 21 box gives :
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);
^
...
这是与BlueZ版本5.23和GCC 4.9.2一起使用的.如果删除 -std = c ++ 11
标志,一切正常.
This is with BlueZ version 5.23 and GCC 4.9.2. Everything works if I remove the -std=c++11
flag.
这正常吗?
推荐答案
默认情况下,GCC编译为具有GNU扩展名的C ++ 03.如果指定 -std = C ++ 11
,则它将编译为ISO C ++ 11,且未启用任何扩展名.但是,如果您指定 -std = gnu ++ 11
,那么您还将获得GNU扩展.
By default GCC compiles to C++03 with GNU extensions. If you specify -std=C++11
then it compiles to ISO C++11 with no extensions enabled. However if you specify -std=gnu++11
instead then you also get the GNU extensions.
这篇关于C ++ 11程序可以使用BlueZ吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!