glm使用什么编译/链接机制?

Bìn*_*yên 0 opengl glm-math

我目前正在使用OpenGL使用glm库,我看到每个头文件(*.hpp)都有自己的实现文件(*.inl)但是每次编译项目时如何自动编译(或链接)glm?例如:

#include <glm/glm.hpp>
// We actualy dont included any *.inl files
// And in glm.hpp (or any *.hpp files) are not included too!
Run Code Online (Sandbox Code Playgroud)

但是在编译时,它没有错误!

Kim*_*imi 6

从glm/glm/core/dummy.cpp:

/// GLM is a header only library. There is nothing to compile. 
/// dummy.cpp exist only a wordaround for CMake file.
Run Code Online (Sandbox Code Playgroud)

因此,您必须在项目中包含标题,这就是它(类似于boost).你对.inl文件是正确的,它们包含在标题中.标题有警卫,所以没有重复.