gpt4 book ai didi

c++ - GLM : Can't compile anymore

转载 作者:行者123 更新时间:2023-11-28 03:20:18 24 4
gpt4 key购买 nike

有人用this library吗?了?

去年对我来说效果很好,但现在我的代码无法编译:

(在带有 GCC 4.6.1 的 MinGW 上):

In file included from ../include/glm/./core/func_packing.hpp:190:0,
from ../include/glm/glm.hpp:103,
from SmoothRenderer.cpp:11:
../include/glm/./core/func_packing.inl: In function 'glm::detail::uint32 glm::packUnorm4x8(const glm::detail::tvec4<float>&)':
../include/glm/./core/func_packing.inl:84:17: error: expected primary-expression before '(' token
../include/glm/./core/func_packing.inl:84:17: error: expected primary-expression before ')' token
../include/glm/./core/func_packing.inl:84:17: error: expected ';' before 'round'
../include/glm/./core/func_packing.inl:85:26: error: 'D' was not declared in this scope
../include/glm/./core/func_packing.inl: In function 'glm::detail::tvec4<float> glm::unpackUnorm4x8(const uint32&)':
../include/glm/./core/func_packing.inl:94:38: warning: statement has no effect [-Wunused-value]
../include/glm/./core/func_packing.inl:99:4: error: 'D' was not declared in this scope

这是最新版本 0.9.4.3。

我的 Mac 使用最新的 clang 时出现类似问题:

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);
^
;

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

我只将它用于某些 4x4 矩阵乘法和求逆。由于我的应用程序的其余部分广泛使用 LAPACK,所以我真的不需要 glm 做任何事情。但是我讨厌当我尝试使非常便携的代码随机中断时这样。

最佳答案

是的,原来是 D 宏的问题。该死的,问了4分钟才回答我的问题。这就是解释问题的美妙之处。一半时间就够了。

这是避免使用预处理器的又一原因。疯狂的错误。不过,值得赞扬的是,clang 非常好,它不仅提到在其他地方定义的宏似乎有问题,它甚至还把它复制到那里给我看。

关于c++ - GLM : Can't compile anymore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15629065/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com