【发布时间】:2014-06-30 15:31:30
【问题描述】:
几天前我从 Windows 切换到 Linux,到目前为止非常喜欢它。不幸的是,我在移植我的项目时遇到了问题。在那里,我将 GLM 用于矢量计算和原子计算。在 Visual Studio 上一切正常。
我遇到的第一个问题是,由于某种原因,g++ 4.6 在我包含atomic 标头后立即给了我一个undefined referece to。然后我切换到 g++ 4.8,问题就消失了。但是现在,只要我使用带有这样矢量的原子:atomic<vec3>,我就会遇到一个新问题。这就是 g++ 所说的:
/usr/include/c++/4.8/atomic|167|error: function ‘std::atomic<_Tp>::atomic() [with _Tp = glm::detail::tvec3<float>]’ defaulted on its first declaration with an exception-specification that differs from the implicit declaration ‘std::atomic<glm::detail::tvec3<float> >::atomic()’|
我不知道如何解决这个问题。我想尝试 g++ 4.9,但我什至不知道如何获得它。这是一个简单的代码,它在我的机器上崩溃了:
#include <iostream>
#include <glm.hpp>
#include <atomic>
using namespace std;
using namespace glm;
atomic<vec3> b;
int main(){
cout << "hello" << endl;
return 0;
}
我使用 Code::Blocks 作为 IDE。当我使用 clang++ 时,我得到了与 g++ 4.6 相同的错误。
【问题讨论】:
标签: c++ linux gcc g++ glm-math