C++ GLM无法使用g++/C++;11

C++ GLM无法使用g++/C++;11,c++,c++11,gcc,g++,glm-math,C++,C++11,Gcc,G++,Glm Math,我试图将其用于一个游戏项目,但是当使用g++和-std=c++11进行编译时,我会遇到很多编译错误 这是我试图编译的代码:(摘自) 编译器输出: In file included from glm/gtx/../detail/func_trigonometric.hpp:205:0, from glm/gtx/../trigonometric.hpp:35, from glm/gtx/../glm.hpp:110,

我试图将其用于一个游戏项目,但是当使用g++和-std=c++11进行编译时,我会遇到很多编译错误

这是我试图编译的代码:(摘自)

编译器输出:

In file included from glm/gtx/../detail/func_trigonometric.hpp:205:0,
                 from glm/gtx/../trigonometric.hpp:35,
                 from glm/gtx/../glm.hpp:110,
                 from glm/gtx/io.hpp:50,
                 from glmtest.cpp:2:
glm/gtx/../detail/func_trigonometric.inl:166:14: error: 'std::asinh' has not been declared
   using std::asinh;
              ^
In file included from glm/gtx/../detail/func_trigonometric.hpp:205:0,
                 from glm/gtx/../trigonometric.hpp:35,
                 from glm/gtx/../glm.hpp:110,
                 from glm/gtx/io.hpp:50,
                 from glmtest.cpp:2:
glm/gtx/../detail/func_trigonometric.inl:185:14: error: 'std::acosh' has not been declared
   using std::acosh;
              ^
glm/gtx/../detail/func_trigonometric.inl:206:14: error: 'std::atanh' has not been declared
   using std::atanh;
              ^
In file included from glm/gtx/../detail/func_exponential.hpp:132:0,
                 from glm/gtx/../exponential.hpp:35,
                 from glm/gtx/../glm.hpp:111,
                 from glm/gtx/io.hpp:50,
                 from glmtest.cpp:2:
glm/gtx/../detail/func_exponential.inl:43:14: error: 'std::log2' has not been declared
   using std::log2;
              ^
In file included from glm/gtx/../detail/func_common.hpp:455:0,
                 from glm/gtx/../common.hpp:35,
                 from glm/gtx/../glm.hpp:112,
                 from glm/gtx/io.hpp:50,
                 from glmtest.cpp:2:
glm/gtx/../detail/func_common.inl:229:16: error: 'std::trunc' has not been declared
   using ::std::trunc;
                ^
glm/gtx/../detail/func_common.inl:248:16: error: 'std::round' has not been declared
   using ::std::round;
                ^
glm/gtx/../detail/func_common.inl: In instantiation of 'vecType<T, P> glm::round(const vecType<T, P>&) [with T = float; glm::precision P = (glm::precision)0u; vecType = glm::tvec2]':
glm/gtx/../detail/func_packing.inl:47:55:   required from here
glm/gtx/../detail/func_common.inl:262:59: error: no matching function for call to 'glm::detail::functor1<float, float, (glm::precision)0u, glm::tvec2>::call(<unresolved overloaded function type>, const glm::tvec2<float, (glm::precision)0u>&)'
   return detail::functor1<T, T, P, vecType>::call(round, x);
                                                           ^
glm/gtx/../detail/func_common.inl:262:59: note: candidate is:
In file included from glm/gtx/../detail/func_trigonometric.inl:33:0,
                 from glm/gtx/../detail/func_trigonometric.hpp:205,
                 from glm/gtx/../trigonometric.hpp:35,
                 from glm/gtx/../glm.hpp:110,
                 from glm/gtx/io.hpp:50,
                 from glmtest.cpp:2:
glm/gtx/../detail/_vectorize.hpp:58:41: note: static glm::tvec2<R, P> glm::detail::functor1<R, T, P, glm::tvec2>::call(R (*)(T), const glm::tvec2<T, P>&) [with R = float; T = float; glm::precision P = (glm::precision)0u]
   GLM_FUNC_QUALIFIER static tvec2<R, P> call(R (*Func) (T x), tvec2<T, P> const & v)
                                         ^
glm/gtx/../detail/_vectorize.hpp:58:41: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float (*)(float)'
In file included from glm/gtx/../detail/func_common.hpp:455:0,
                 from glm/gtx/../common.hpp:35,
                 from glm/gtx/../glm.hpp:112,
                 from glm/gtx/io.hpp:50,
                 from glmtest.cpp:2:
glm/gtx/../detail/func_common.inl: In instantiation of 'vecType<T, P> glm::round(const vecType<T, P>&) [with T = float; glm::precision P = (glm::precision)0u; vecType = glm::tvec4]':
glm/gtx/../detail/func_packing.inl:105:52:   required from here
glm/gtx/../detail/func_common.inl:262:59: error: no matching function for call to 'glm::detail::functor1<float, float, (glm::precision)0u, glm::tvec4>::call(<unresolved overloaded function type>, const glm::tvec4<float, (glm::precision)0u>&)'
   return detail::functor1<T, T, P, vecType>::call(round, x);
                                                           ^
glm/gtx/../detail/func_common.inl:262:59: note: candidate is:
In file included from glm/gtx/../detail/func_trigonometric.inl:33:0,
                 from glm/gtx/../detail/func_trigonometric.hpp:205,
                 from glm/gtx/../trigonometric.hpp:35,
                 from glm/gtx/../glm.hpp:110,
                 from glm/gtx/io.hpp:50,
                 from glmtest.cpp:2:
glm/gtx/../detail/_vectorize.hpp:76:41: note: static glm::tvec4<R, P> glm::detail::functor1<R, T, P, glm::tvec4>::call(R (*)(T), const glm::tvec4<T, P>&) [with R = float; T = float; glm::precision P = (glm::precision)0u]
   GLM_FUNC_QUALIFIER static tvec4<R, P> call(R (*Func) (T x), tvec4<T, P> const & v)
                                         ^
glm/gtx/../detail/_vectorize.hpp:76:41: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float (*)(float)'
包含在glm/gtx/./detail/func_trigonomic.hpp:205:0中的文件中,
来自glm/gtx//三角函数。hpp:35,
来自glm/gtx/。/glm.hpp:110,
来自glm/gtx/io.hpp:50,
来自glmtest.cpp:2:
glm/gtx/。/detail/func_trigonal.inl:166:14:错误:“std::asinh”尚未声明
使用std::asinh;
^
在glm/gtx/./detail/func_trigonomic.hpp:205:0中包含的文件中,
来自glm/gtx//三角函数。hpp:35,
来自glm/gtx/。/glm.hpp:110,
来自glm/gtx/io.hpp:50,
来自glmtest.cpp:2:
glm/gtx/。/detail/func_trigonal.inl:185:14:错误:“std::acosh”尚未声明
使用std::acosh;
^
glm/gtx/。/detail/func_trigonal.inl:206:14:错误:“std::atanh”尚未声明
使用std::atanh;
^
在glm/gtx/./detail/func_index.hpp:132:0中包含的文件中,
来自glm/gtx//指数。hpp:35,
来自glm/gtx/。/glm.hpp:111,
来自glm/gtx/io.hpp:50,
来自glmtest.cpp:2:
glm/gtx/。/detail/func_index.inl:43:14:错误:“std::log2”尚未声明
使用std::log2;
^
在glm/gtx/./detail/func_common.hpp:455:0中包含的文件中,
来自glm/gtx//通用。hpp:35,
来自glm/gtx/。/glm.hpp:112,
来自glm/gtx/io.hpp:50,
来自glmtest.cpp:2:
glm/gtx/。/detail/func_common.inl:229:16:错误:“std::trunc”尚未声明
使用::std::trunc;
^
glm/gtx/。/detail/func_common.inl:248:16:错误:“std::round”尚未声明
使用::std::round;
^
glm/gtx/。/detail/func_common.inl:在“vecType glm::round(const vecType&)[带T=float;glm::precision P=(glm::precision)0u;vecType=glm::tvec2]”的实例化中:
glm/gtx//详细信息/功能包装。inl:47:55:此处为必填项
glm/gtx/。/detail/func_common.inl:262:59:错误:调用“glm::detail::functor1::call(,const glm::tvec2&)”时没有匹配的函数
返回详细信息::functor1::调用(轮,x);
^
glm/gtx/。/detail/func_common.inl:262:59:注:候选人是:
在glm/gtx/./detail/func_trigonomic.inl:33:0中包含的文件中,
摘自glm/gtx/。/detail/func_trigonal.hpp:205,
来自glm/gtx//三角函数。hpp:35,
来自glm/gtx/。/glm.hpp:110,
来自glm/gtx/io.hpp:50,
来自glmtest.cpp:2:
glm/gtx/。/detail/_vectorize.hpp:58:41:注:静态glm::tvec2 glm::detail::functor1::调用(R(*)(T),常量glm::tvec2&)[带R=float;T=float;glm::precision P=(glm::precision)0u]
GLM_FUNC_限定符静态tvec2调用(R(*FUNC)(T x),tvec2常量&v)
^
glm/gtx/。/detail/_vectorize.hpp:58:41:注意:参数1没有从“”到“float(*)(float)”的已知转换
在glm/gtx/./detail/func_common.hpp:455:0中包含的文件中,
来自glm/gtx//通用。hpp:35,
来自glm/gtx/。/glm.hpp:112,
来自glm/gtx/io.hpp:50,
来自glmtest.cpp:2:
glm/gtx/。/detail/func_common.inl:在“vecType glm::round(const vecType&)[带T=float;glm::precision P=(glm::precision)0u;vecType=glm::tvec4]”的实例化中:
glm/gtx//详细信息/功能包装。inl:105:52:此处为必填项
glm/gtx/。/detail/func_common.inl:262:59:错误:调用“glm::detail::functor1::call(,const glm::tvec4&)”时没有匹配的函数
返回详细信息::functor1::调用(轮,x);
^
glm/gtx/。/detail/func_common.inl:262:59:注:候选人是:
在glm/gtx/./detail/func_trigonomic.inl:33:0中包含的文件中,
摘自glm/gtx/。/detail/func_trigonal.hpp:205,
来自glm/gtx//三角函数。hpp:35,
来自glm/gtx/。/glm.hpp:110,
来自glm/gtx/io.hpp:50,
来自glmtest.cpp:2:
glm/gtx/。/detail/_vectorize.hpp:76:41:注意:静态glm::tvec4 glm::detail::functor1::call(R(*)(T),const glm::tvec4&)[带R=float;T=float;glm::precision P=(glm::precision)0u]
GLM_FUNC_限定符静态tvec4调用(R(*FUNC)(T x),tvec4常量&v)
^
glm/gtx/。/detail/_vectorize.hpp:76:41:注意:参数1从“”到“float(*)(float)”的转换未知
似乎无法从cmath中找到某些函数,但如果在包含glm之前包含cmath,这些错误仍然存在


有什么建议吗?

这在我的机器上编译并使用c++11标准的gcc 4.8.2运行得很好

我收到一系列警告

/usr/include/glm/gtc/quaternion.inl:639:165: note: #pragma message: GLM: rotate function taking degrees as a parameter is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.
但是如果我把代码改成

#define GLM_FORCE_RADIANS
#include "glm/vec3.hpp"
#include "glm/gtx/io.hpp"
#include <iostream>

using namespace std;
using glm::vec3;

int main () {
    vec3 i_am_zero;

    cout << i_am_zero << endl;
    return 0;
}
#定义GLM_力_弧度
#包括“glm/vec3.hpp”
#包括“glm/gtx/io.hpp”
#包括
使用名称空间std;
使用glm::vec3;
int main(){
vec3我是零;

cout这似乎是GLM版本0.9.7的一个bug。降级到0.9.5为我解决了这个问题。它被跟踪为。

我在GLM 0.9.7和g++4.9.3上。我将尝试使用GLM 0.9.5。降级修复了这个问题。我将在他们的GitHub上作为bug提交。谢谢你的回答!你能在这里链接这个问题吗?当然,给我一个s欧共体必须把它写下来。
/usr/include/glm/gtc/quaternion.inl:639:165: note: #pragma message: GLM: rotate function taking degrees as a parameter is deprecated. #define GLM_FORCE_RADIANS before including GLM headers to remove this message.
#define GLM_FORCE_RADIANS
#include "glm/vec3.hpp"
#include "glm/gtx/io.hpp"
#include <iostream>

using namespace std;
using glm::vec3;

int main () {
    vec3 i_am_zero;

    cout << i_am_zero << endl;
    return 0;
}