Skip to content

How to compile glm for use? And bug feedback #1438

Description

@sdragonx

Define GLM_EXTERNAL_TEMPLATE in the header file, and enter the code in a cpp file:

pch.h:

#define GLM_EXTERNAL_TEMPLATE
// #define GLM_SILENT_WARNINGS // ???

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/type_ptr.hpp>

#include <glm/ext.hpp>
#include <glm/gtx/intersect.hpp>
#include <glm/gtx/io.hpp>
#include <glm/gtx/matrix_decompose.hpp>
#include <glm/gtx/normal.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtx/vector_angle.hpp>

glm_imp.cpp:

#undef GLM_EXTERNAL_TEMPLATE

#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtc/type_ptr.hpp>

#include <glm/ext.hpp>
#include <glm/gtx/intersect.hpp>
#include <glm/gtx/io.hpp>
#include <glm/gtx/matrix_decompose.hpp>
#include <glm/gtx/normal.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/rotate_vector.hpp>
#include <glm/gtx/vector_angle.hpp>

compilation produces many errors.
Image

x:\include\glm\ext\quaternion_geometric.inl:7: error: 'call' is not a member of 'glm::detail::compute_dot<glm::qua<float, (glm::qualifier)0>, float, false>'
   return detail::compute_dot<qua<T, Q>, T, detail::is_aligned<Q>::value>::call(x, y);
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~

And in the process of gcc compilation, there will be many warnings that lead to too much output:

Image
x:\include\glm\detail\type_vec2.hpp:108: warning: inline function 'constexpr glm::vec<2, T, Q>::vec(T) [with T = float; glm::qualifier Q = (glm::qualifier)0]' used but never defined
   GLM_CTOR_DECL explicit vec(T scalar);
                          ^~~

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions