GLM:无法编译

问题描述:

有人使用this library了吗?GLM:无法编译

对我来说真是棒极了去年,但现在我的代码不会编译:

(MingW平台上使用GCC 4.6.1):

​​

这是最新的0.9.4.3版本。

在我的Mac类似的问题与最新的铿锵:

In file included from SmoothRenderer.cpp:10: 
In file included from ../include/glm/glm.hpp:103: 
In file included from ../include/glm/./core/func_packing.hpp:190: 
../include/glm/core/func_packing.inl:84:33: error: expected '(' for function-style cast or type construction 
       detail::uint8 D((detail::uint8)round(clamp(v.w, 0.0f, 1.0f) * 255.0f)); 
           ~~~~~~~~~~~~~^ 
./util.h:330:15: note: expanded from macro 'D' 
# define D(x) x 
      ^
In file included from SmoothRenderer.cpp:10: 
In file included from ../include/glm/glm.hpp:103: 
In file included from ../include/glm/./core/func_packing.hpp:190: 
../include/glm/core/func_packing.inl:85:26: error: use of undeclared identifier 'D' 
       return detail::uint32((D << 24) | (C << 16) | (B << 8) | A); 
            ^
../include/glm/core/func_packing.inl:99:4: error: use of undeclared identifier 'D' 
         D * 1.0f/255.0f); 
         ^
../include/glm/core/func_packing.inl:94:30: warning: expression result unused [-Wunused-value] 
       detail::uint32 D((p >> 24) & Mask8); 
       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ 
./util.h:330:15: note: expanded from macro 'D' 
# define D(x) x 
      ^
In file included from SmoothRenderer.cpp:10: 
In file included from ../include/glm/glm.hpp:108: 
In file included from ../include/glm/./core/func_noise.hpp:85: 
../include/glm/core/func_noise.inl:125:33: error: too many arguments provided to function-like macro invocation 
       detail::tvec4<T> const D(0.0, 0.5, 1.0, 2.0); 
              ^
../include/glm/core/func_noise.inl:125:27: error: expected ';' at end of declaration 
       detail::tvec4<T> const D(0.0, 0.5, 1.0, 2.0); 
             ^
             ; 

这是一个只有标题库。像这样的事情不应该发生......

我只使用这一些4×4矩阵乘法和倒置。由于我的应用程序的其余部分广泛使用LAPACK,因此我确实不需要glm。但我讨厌当我尝试使便携式随机打破这样的代码。

+0

我刚刚意识到。可能会有一个宏观冲突,因为我在过渡期间记得对我的调试宏进行了更改,将其从'DEBUG'重命名为'D'。这太可怕了。 – 2013-03-26 03:51:29

是的,它原来是一个与D宏有关的问题。该死的,在提问后4分钟回答我的问题。这是解释问题的美妙之处。一半的时间就够了。

这是避免使用预处理器的另一个原因。疯狂的错误。尽管如此,铿锵声已经足够好,不仅提到某些事物似乎与其他地方定义的宏有关,而且甚至将它复制到那里以向我展示。