Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble Including / Using GLM library
    primarykey
    data
    text
    <p>I am having trouble properly including / using the glm math library (<a href="http://glm.g-truc.net/">http://glm.g-truc.net/</a> ) in my c++ project. Since glm is a "header only" library, I thought I could just include it with this line:</p> <pre><code>#include "glm/glm.hpp" </code></pre> <p>At first this seemed to be working, as I could create and use matrices and vectors. However when I tried to use the <code>glm::translate(...)</code> function I got this error:</p> <pre><code>error: ‘translate’ is not a member of ‘glm’ </code></pre> <p>On the GLM website, they recommend including the library with triangle brackets, like so:</p> <pre><code>#include &lt;glm/glm.hpp&gt; </code></pre> <p>...but isn't it correct to think that I can include it the other way, given that it is inside the project directory structure? </p> <p>I have set up the test below to illustrate the problem I am having. The <code>glm</code> folder is sitting next to the <code>testglm.cpp</code> file.</p> <pre><code>#include &lt;iostream&gt; #include "glm/glm.hpp" using namespace std; int main(void) { // works: glm::mat4 testMatrix1 = glm::mat4(5.0f) * glm::mat4(2.0f); cout &lt;&lt; testMatrix1[0][0] &lt;&lt; endl; // output: 10 // doesn't work - (error: ‘translate’ is not a member of ‘glm’): glm::mat4 testMatrix2 = glm::translate(glm::mat4(1.0f), glm::vec3(1.0f)); } </code></pre> <p>I am building this test with this build command from the terminal, on osx:</p> <pre><code>g++ -o bin/glm_test src/testglm.cpp </code></pre> <p>I'm not sure if my problem relates to how I'm including the library, how I'm using it, or how I'm building the project. Google does not give me any hits for that error message, so I wonder if I am doing something fundamentally wrong. Advice would be much appreciated. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload