我目前正在为一个任务编写一个非常简单的游戏引擎,为了让代码更好,我决定使用一个向量数学库。我的一位讲师向我展示了索尼矢量数学库,该库用于Bullet物理引擎,据我所知,它非常棒。我已经让它在Linux上工作得很好,但我在将它移植到OS X(英特尔,雪豹)上遇到了问题。我已经在我的项目中正确地包含了这些文件,但是这个库的C++版本似乎无法编译。我可以让C版本的库工作,但与C++版本相比,它有一个相当糟糕的应用程序接口,使用这个库的全部原因是为了首先整洁代码。
http://glosx.blogspot.com/2008/07/sony-vector-math-library.html
我偶然发现的这篇博文似乎暗示着编译器出了什么问题?它相当短,所以我不能从中获取很多信息。
当我尝试使用C++版本时,我得到以下错误(每个错误的展开视图):
/usr/include/vectormath/cpp/../SSE/cpp/vectormath_aos.h:156:0
/usr/include/vectormath/cpp/../SSE/cpp/vectormath_aos.h:156:
error: '__forceinline' does not name a type第二个错误:
/Developer/apps/gl test/main.cpp:7:0 In file included from /Developer/apps/gl test/main.cpp
/usr/include/vectormath/cpp/vectormath_aos.h:38:0 In file included from
/usr/include/vectormath/cpp/vectormath_aos.h
/usr/include/vectormath/cpp/../SSE/cpp/vectormath_aos.h:330:0 In file included from
/usr/include/vectormath/cpp/../SSE/cpp/vectormath_aos.h
/usr/include/vectormath/cpp/../SSE/cpp/vecidx_aos.h:45:0 Expected constructor, destructor,
or type conversion before '(' token in /usr/include/vectormath/cpp/../SSE/cpp/vecidx_aos.h最后,在main.cpp文件的末尾有两个错误:
Expected '}' at the end of input
Expected '}' at the end of input我已经用谷歌搜索了我的心,但我似乎找不到任何答案或任何东西来指引我正确的方向,所以任何帮助都会得到极大的欢迎。
谢谢,
发布于 2010-03-03 06:14:51
你在OS上使用的是哪种编译器?在标准的Xcode3.2安装中有4个可供选择,默认值是gcc 4.2。你最好还是试试gcc 4.0吧。
发布于 2010-03-03 06:16:07
__forceinline是一个保留字,只有几个编译器支持。显然,您的编译器不支持__forceinline关键字,所讨论的代码是不可移植的。
一种非常糟糕的解决方法是向编译器传递一个新的定义,以赋予关键字正确的含义。例如:-D__forceinline=inline或-D__forceinline=__attribute__((always_inline)) (谢谢保罗!)
发布于 2010-10-29 08:00:17
SSE版本被假定为仅适用于Microsoft Visual Studio。对于其他平台(Mac等),您可以使用标量版本。
Bullet\Extras\vectormathlibrary\include\vectormath\scalar\cpp
https://stackoverflow.com/questions/2367171
复制相似问题