Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker error w/ 0.9.7 #377

Closed
ghost opened this issue Aug 5, 2015 · 5 comments
Closed

Linker error w/ 0.9.7 #377

ghost opened this issue Aug 5, 2015 · 5 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Aug 5, 2015

Edit - A further note, if it helps - I can still create a mat4 as a local variable, on the stack, inside a member function of my display class; the problem I've described only affects class member variables (as far as I know). And it's only matrices that have the trouble, not vec3's or vec4's. (And for what it's worth, the display class in question is a descendant of a WTL template window class. I have no idea if that's relevant or not.)

And this isn't corrected by cleaning the debris from builds against 0.9.6.n. A clean build fails when using 0.9.7, and works with 0.9.6.4 (and previous).


Using VS2010 Pro SP1, on Win7 x64, building a 32-bit app -

Using the following include/defines -

define GLM_MESSAGES

define GLM_FORCE_RADIANS

include glm/glm.hpp

include glm/gtc/matrix_transform.hpp

include glm/gtx/transform.hpp

using glm::mat4;
using glm::mat3;
using glm::vec3;
using glm::vec4;

The following compile-time messages are produced -

GLM: version 0.9.6.4
GLM: Windows platform detected
GLM: Visual C++ compiler detected
GLM: 32 bits model
GLM: C++0x
GLM: Language extensions enabled
GLM: Platform independent code
GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators
GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification
GLM: Core library included
GLM: GLM_GTC_constants extension included
GLM: GLM_GTC_matrix_transform extension included
GLM: GLM_GTX_transform extension included

I declare a mat4 class member in a class header file:
mat4 m_ModelMatrix;

That class member variable is initialized in code in the associated .cpp file:
m_ModelMatrix = mat4(1.0f);

With GLM 0.9.6.4 (as the GLM version message above indicates), this compiles just fine (as it has w/ every version since I started using GLM).

With 0.9.7, I get the following linker error:

GLDisplay.obj : error LNK2019: unresolved external symbol "public: struct glm::tmat4x4<float,0> & __thiscall glm::tmat4x4<float,0>::operator=(struct glm::tmat4x4<float,0> const &)" (??4?$tmat4x4@M$0A@@glm@@QAEAAU01@ABU01@@z) referenced in function "private: void __thiscall CGLDisplay::GLInit(void)" (?GLInit@CGLDisplay@@AAEXXZ)
1>C:\some_directory\Debug\some_app.exe : fatal error LNK1120: 1 unresolved externals

The only difference in compile time messages is a different version number (0.9.7.0).

Any ideas or help would be appreciated.

@wierich
Copy link

wierich commented Aug 19, 2015

VS 2012 is not able to interpret any of the

#if !GLM_HAS_DEFAULTED_FUNCTIONS ...

correctly.
One workaround for VS 2012 is to add

) == 0 ? 0 : 1

at the last line of the following code in the file detail/setup.hpp

#   define GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\
        ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC44)) || \
        ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013)) || \
        ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12)))) == 0 ? 0 : 1

Do not forget the bracket added in the first line of the code.

@ghost
Copy link
Author

ghost commented Aug 19, 2015

Thanks! That did the trick.

(So.... is this going to be flagged as a bug and fixed?)

But thanks again. Very helpful.

👍

Edit - Sorry - didn't mean to close this. Clicked the wrong button.

@ghost ghost closed this as completed Aug 19, 2015
@ghost ghost reopened this Aug 19, 2015
@wierich
Copy link

wierich commented Aug 31, 2015

I agree with you, this should be marked as a bug.

@Groovounet
Copy link
Member

Pretty major bug here. It happens also on Visual C++ 2010.

This is now fixed in master branch for GLM 0.9.7.1 release.

Thanks for reporting,
Christophe

@MicroSDA
Copy link

Its still not work. I use 0.9.7.3 and i have error LNK2019: unresolved external symbol "public: struct
glm::tmat4x4<float,0> in VS 2015, 2013 and 2010.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants