Is GLM compataible with GLload and GCC

430 views Asked by At

I am currently getting my OpenGL 'framework' set up, and have settled on using GLload, mostly for the extension loading, but it has the added benefit of proving a proper 'gl' name space. As such, al gl* functions are instead used as gl::* for example:

glUniformMatrix4fv(...) // instead of this
gl::UniformMatrix4fv(...) // use this

I also want to make use of glm, which from my understanding, should be as simple as include glm/glm.hpp and ensure I tell my compiler where to find this. But it seems that it may not be compatible directly with glload, for I get the following errors when I try compile with it.

In file included from glm/glm/fwd.hpp:32:0,
                 from glm/glm/glm.hpp:91,
                 from src/main.cpp:3:
glm/glm/core/type_int.hpp:220:2: error: redefinition of ‘struct glm::detail::is_int<long int>’
glm/glm/core/type_int.hpp:219:2: error: previous definition of ‘struct glm::detail::is_int<long int>’
glm/glm/core/type_int.hpp:250:2: error: redefinition of ‘struct glm::detail::is_uint<long unsigned int>’
glm/glm/core/type_int.hpp:249:2: error: previous definition of ‘struct glm::detail::is_uint<long unsigned int>’

From looking at type_int.hpp you can see that it using a macro, first to with 'signed long' and 'unsigned long' respectively, then with 'highp_int_t' and 'highp_uint_t' (causing this error). These two redefining types are 'int64' and 'uint64', which exact types are dependent on compiler. As I am using GCC I believe means I should see these types as 'signed long long' and 'usigned long long'.

If I do comment out these two lines, everything seems to compile just fine. Of course, I am sure sooner or later it will turn out I broke something by doing so.

Looking up similar questions took me to this answer, that basically says glm does not support being built with -std=C++11, which for me is not acceptable; but this answer is nearly two years old, and glm's site does claim full C++11 compatibility.

And for reference, I am using gcc version 4.7.3, glm version 0.9.5 (as pulled from the github repo), glload from version 0.4.4 of glsdk (I have removed all other 'modules' of the glsdk, leaving me justglload).

1

There are 1 answers

3
thecoshman On BEST ANSWER

Ok, it seems to be a problem with using version 0.9.5 of GLM.

Thankfully I had used a git submodule, so I was able to test with version 0.9.4 handy enough. It seems that version 0.9.4 is working just fine for me.