sgorsten / linalg

linalg.h is a single header, public domain, short vector math library for C++
The Unlicense
854 stars 68 forks source link

Doesn't build on MSVC 2017 #19

Closed mlfarrell closed 5 years ago

mlfarrell commented 5 years ago

1>c:\vs_projs\vulkan repo\example\include\linalg.h(305): error C2988: unrecognizable template declaration/definition 1>c:\vs_projs\vulkan repo\example\include\linalg.h(305): error C2059: syntax error: 'const' 1>c:\vs_projs\vulkan repo\example\include\linalg.h(305): error C2059: syntax error: ')' 1>c:\vs_projs\vulkan repo\example\include\linalg.h(305): error C2143: syntax error: missing ';' before '{' 1>c:\vs_projs\vulkan repo\example\include\linalg.h(305): error C2447: '{': missing function header (old-style formal list?)

"Fixed" by commenting out the affected line

sgorsten commented 5 years ago

Lines 305 and 306 define the min and max functions respectively. On Windows-based platforms, the Windows.h header defines min and max macros, and if you include it before including linalg.h, they will interfere with the definition of these functions. The typical solution is to #define NOMINMAX before including Windows.h (or specify it as a preprocessor definition on the command line), but if you actually WANT the macro-based min and max, you can simply remove or rename these two functions as needed.

mlfarrell commented 5 years ago

Ohhh! I'm an idiot. Sorry.

jacmoe commented 3 years ago

I ran into this problem as well :) Perhaps a note about this could be added to the readme?