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

There is an annoying min macro inside minwindef.h that's conflicting with glm::min function #360

Closed
Infinitusvoid opened this issue May 22, 2023 · 2 comments

Comments

@Infinitusvoid
Copy link

Infinitusvoid commented May 22, 2023

When I import

#include "soloud.h"
#include "soloud_wav.h"

void theIssue() {
	glm::vec3 a(1.0f, 1.0f, 1.0f);
	glm::vec3 b(2.0f, 2.0f, 2.0f);
	glm::min(a, a);
}

if I don't import works

//#include "soloud.h"
//#include "soloud_wav.h"

void theIssue() {
	glm::vec3 a(1.0f, 1.0f, 1.0f);
	glm::vec3 b(2.0f, 2.0f, 2.0f);
	glm::min(a, a);
}


min macro is inside minwindef.h
minwindef.h is located at C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\shared

#ifndef min
#define min(a,b)            (((a) < (b)) ? (a) : (b))
#endif

and it's conflicting with the 
glm::min function 

What do you suggest how should I deal with it ?

@Infinitusvoid Infinitusvoid changed the title There is an annoying macro min macro There is an annoying min macro inside minwinddef.h that's conflicting with glm::min function May 22, 2023
@Infinitusvoid Infinitusvoid changed the title There is an annoying min macro inside minwinddef.h that's conflicting with glm::min function There is an annoying min macro inside minwindef.h that's conflicting with glm::min function May 22, 2023
@Green-Sky
Copy link

Yea, soloud should not include windows.h in any public header.
as a workaround you can define NOMINMAX for the project
or just before all includes of soloud

#define NOMINMAX

@Infinitusvoid
Copy link
Author

Infinitusvoid commented May 22, 2023

Yea, soloud should not include windows.h in any public header. as a workaround you can define NOMINMAX for the project or just before all includes of soloud

#define NOMINMAX

Thanks this helped with #define NOMINMAX everyhing is ok thanks

#define NOMINMAX
#include "soloud.h"
#include "soloud_wav.h"

void theIssue() {
	glm::vec3 a(1.0f, 1.0f, 1.0f);
	glm::vec3 b(2.0f, 2.0f, 2.0f);
	glm::min(a, a);
}

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

2 participants