dpilger26 / NumCpp

C++ implementation of the Python Numpy library
https://dpilger26.github.io/NumCpp
MIT License
3.59k stars 554 forks source link

What is the problem with using NumCpp in windows dynamic library? #169

Closed lion1986 closed 2 years ago

lion1986 commented 2 years ago

I want to use NumCpp in my windows dynamic library, compile failed, Do it can only be used in console application?

environment: visual studio 2022 (c++17) with boost 1.80.0 compile error is : ..include\NumCpp\Core\DtypeInfo.hpp(98,32): warning C4003: not enough arguments for function-like macro invocation 'min' ..include\NumCpp\Core\DtypeInfo.hpp(102,48): warning C4003: not enough arguments for function-like macro invocation 'min' ..include\NumCpp\Core\DtypeInfo.hpp(110,32): warning C4003: not enough arguments for function-like macro invocation 'max' ..include\NumCpp\Core\DtypeInfo.hpp(114,48): warning C4003: not enough arguments for function-like macro invocation 'max' ..include\NumCpp\Core\DtypeInfo.hpp(98,32): error C2059: syntax error: ')' ..include\NumCpp\Core\DtypeInfo.hpp(116,6): message : see reference to class template instantiation 'nc::DtypeInfo' being compiled ..include\NumCpp\Core\DtypeInfo.hpp(98,1): error C2334: unexpected token(s) preceding ':'; skipping apparent function body ..include\NumCpp\Core\DtypeInfo.hpp(116,5): error C2143: syntax error: missing ')' before ';' ..include\NumCpp\Core\DtypeInfo.hpp(116,5): error C2059: syntax error: ')' ..include\NumCpp\Core\DtypeInfo.hpp(116,5): error C2238: unexpected token(s) preceding ';' ..include\NumCpp\Core\DtypeInfo.hpp(116,5): fatal error C1201: unable to continue after syntax error in class template definition

图片

dpilger26 commented 2 years ago

This looks suspiciously like the widows min and max macros causing problems. Try compiling with the compiler define NOMINMAX.

lion1986 commented 2 years ago

This looks suspiciously like the widows min and max macros causing problems. Try compiling with the compiler define NOMINMAX.

OK, Thanks.