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

'quat_cast': identifier not found when using glm as C++20 module #1298

Open
Silverlan opened this issue May 24, 2024 · 0 comments
Open

'quat_cast': identifier not found when using glm as C++20 module #1298

Silverlan opened this issue May 24, 2024 · 0 comments

Comments

@Silverlan
Copy link

The issue happens if you try to use the glm::mat4 constructor of glm::quat, when using glm as a module under Visual Studio 2022. I've tried it with the latest GLM version (45008b2).

Code:

import glm;

int main(int argc, char* argv[]) {
	glm::mat4 m;
	glm::quat q{ m };
	return 0;
}

I've set up a test repository for replicating the problem: https://github.com/Silverlan/test_glm_module
Simply clone the repository (with submodules) and run the build.bat, or fork the repository and check the workflow output.

The line glm::quat q{ m }; causes this error:

D:\a\test_glm_module\test_glm_module\glm_cxxmodule\glm\glm\detail\type_quat.inl(240,11): error C3861: 'quat_cast': identifier not found [D:\a\test_glm_module\test_glm_module\build\glm_test.vcxproj]
  (compiling source file '../main.cpp')
  D:\a\test_glm_module\test_glm_module\glm_cxxmodule\glm\glm\detail\type_quat.inl(240,11):
  'quat_cast': function was not declared in the template definition context and can be found only via argument-dependent lookup in the instantiation context
  D:\a\test_glm_module\test_glm_module\glm_cxxmodule\glm\glm\detail\type_quat.inl(240,11):
  the template instantiation context (the oldest one first) is
  	D:\a\test_glm_module\test_glm_module\main.cpp(5,12):
  	see reference to class template instantiation 'glm::qua<float,glm::packed_highp>' being compiled
  	D:\a\test_glm_module\test_glm_module\glm_cxxmodule\glm\glm\detail\type_quat.inl(239,2):
  	while compiling class template member function 'glm::qua<float,glm::packed_highp>::qua(const glm::mat<4,4,glm::f32,glm::packed_highp> &)'
  		D:\a\test_glm_module\test_glm_module\main.cpp(5,13):
  		see the first reference to 'glm::qua<float,glm::packed_highp>::qua' in 'main'

If you call glm::gtc::quat_cast directly instead of using the constructor, the error vanishes:

import glm;

int main(int argc, char* argv[]) {
	glm::mat4 m;
	glm::quat q = glm::gtc::quat_cast(m);
	return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant