-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
I'm updating GLM from 0.9.5 to 0.9.7.3 and I'm getting a lot of undefined reference errors.
There seem to be duplicate declarations (the exact same function is declared twice, but only defined once), as well as some actual undefined references (i.e. there's a declaration, but no definition).
I'm using SWIG to generate Lua wrappers for GLM, so most template functions are actually instantiated, where they would regularly just not be compiled unless you use them (and you probably wouldn't get any of these errors).
SWIG can't handle all C++ templates, so I could be barking up the wrong tree for some these. Here's an example of some of the errors:
glm/detail/type_vec4.hpp
has 5 declarations for operator*
:
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, T scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tvec1<T, P> const & scalar);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(T scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec1<T, P> const & scalar, tvec4<T, P> const & v);
template <typename T, precision P>
GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2);
But glm/detail/type_vec4.inl
only has 3 definitions:
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v, T scalar)
{
return tvec4<T, P>(
v.x * scalar,
v.y * scalar,
v.z * scalar,
v.w * scalar);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(T scalar, tvec4<T, P> const & v)
{
return tvec4<T, P>(
scalar * v.x,
scalar * v.y,
scalar * v.z,
scalar * v.w);
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{
return tvec4<T, P>(
v1.x * v2.x,
v1.y * v2.y,
v1.z * v2.z,
v1.w * v2.w);
}
And sure enough, I'm getting undefined reference
errors for the 2 missing definitions:
obj/Release/HactEngine/swig_glm_wrap1.o: In function `_wrap___mul__SWIG_157':
/home/sami/IndiumGames/Infamis/engine/build/Release/swig_glm_wrap.cxx:125790: undefined reference to `glm::tvec4<float, (glm::precision)0> glm::operator*<float, (glm::precision)0>(glm::tvec4<float, (glm::precision)0> const&, glm::tvec1<float, (glm::precision)0> const&)'
obj/Release/HactEngine/swig_glm_wrap1.o: In function `_wrap___mul__SWIG_159':
/home/sami/IndiumGames/Infamis/engine/build/Release/swig_glm_wrap.cxx:125854: undefined reference to `glm::tvec4<float, (glm::precision)0> glm::operator*<float, (glm::precision)0>(glm::tvec1<float, (glm::precision)0> const&, glm::tvec4<float, (glm::precision)0> const&)'
I'm getting 6 of these errors from type_vec4.hpp
alone. I'm working my way through the errors as the compiler (g++ 5.2.1) gives them, and I'll report back with a full list of the errors soon.
Should the declarations be removed, or are the definitions actually missing? If the declarations should be removed, I could make a PR. But if the definitions are missing, I'd rather just give you a list (I'd be in over my head trying to write the definitions).