我目前正在写一个非常简单的游戏引擎的分配和使代码要好很多,我决定用一个矢量数学库。我的一个讲师教我这是在子弹物理引擎使用的索尼矢量数学库,它是伟大的,因为据我可以看到。我得到它的工作在Linux上很好,但我有将它移植到OS X(英特尔,雪豹)工作中的问题。我已经在我的项目包含正确的文件,但该库的C ++版本似乎没有编制。我可以得到图书馆工作的C版,但相比于C ++版本,并使用这个库的全部理由相当讨厌的API是neaten代码摆在首位。

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

我GOOGLE了我的心脏了,但我似乎无法找到任何答案或任何点我在正确的方向,任何帮助将大大收到。

谢谢,

有帮助吗?

解决方案

你在OS X上使用的是哪个编译

?有4个来自于标准的Xcode 3.2,选择安装,默认是gcc 4.2。你可能会更好试图GCC 4.0。

其他提示

__forceinline是一个保留字由只有几个编译器支持。显然,编译器不支持__forceinline关键字和有问题的代码是不便携的。

A 很差的解决办法是通过一项新的定义,以你的编译器,使该关键字的正确含义。 E.g -D__forceinline=inline-D__forceinline=__attribute__((always_inline))(!谢谢保罗)

在SSE版本被认为是只针对微软的Visual Studio。对于其他平台(苹果机等),你可以使用标量版本。

子弹\附加\ vectormathlibrary \包括\ vectormath \标量\ CPP

它看起来像一个人的解决了这个问题并发布的修补版本响应于这个非常问题。

现在GCC兼容。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top