简体   繁体   中英

GLM Define a vec3 after declaration

I am trying to write a program using OpenGL. I am using the GLM header-only library for its vector and matrix functions, and I have run into something really weird.

I have a glm::vec3 that I want to use as the position for an object, so I declare it in my header file ( glm::vec3 position; ) and then I want to actually set it in the object constructor ( position = glm::vec3(0.0f, 0.0f, 0.0f) ). When I try to compile this, I get a LNK2019 error.

To make diagnosing this easier, I have tested the following two pieces of code:

glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f);

and

glm::vec3 position;
position = glm::vec3(0.0f, 0.0f, 0.0f);

The first one compiles and runs absolutely fine.

The second one gets the LNK2019 error:

main.obj : error LNK2019: unresolved external symbol "public: struct
glm::tvec3<float,0> & __thiscall glm::tvec3<float,0>::operator=(struct 
glm::tvec3<float,0> const &)" (??4?$tvec3@M$0A@@glm@@QAEAAU01@ABU01@@Z) 
referenced in function _main

I am probably missing something really obvious, but I cannot figure it out. I am using VS2010, if that makes any difference.

I have been playing around with this myself. It appears that the issue is with the new version of GLM; 0.9.7.0. I downloaded each of the previous versions back to 0.9.5.4 and did not experience this issue.

Since the new version was uploaded less than a month ago I think I can assume there is some kind of bug with it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM