Skip to content

Commit

Permalink
workaround msvc issue with C++17 consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud committed Mar 25, 2022
1 parent 5d418c4 commit 3450df0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CXSparse/Include/cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@
#include "cs_export.h"

#ifndef NCOMPLEX
/*
* A workaround for Visual Studio 2022 which does not define _Dcomplex if the
* consumer enabled the /std:c++17 flag. In this case, <complex.h> includes
* <ccomplex> which in turn includes <complex> that omits the necessary type
* definition.
*/
#if defined(__cplusplus) && defined(_MSC_VER)
/* Adjust the definition of _CRT_USE_C_COMPLEX_H unless it is already defined
* and at the same time is non zero */
# if !(defined(_CRT_USE_C_COMPLEX_H) && !_CRT_USE_C_COMPLEX_H)
# if defined(_CRT_USE_C_COMPLEX_H)
# undef _CRT_USE_C_COMPLEX_H
# endif
# define _CRT_USE_C_COMPLEX_H 1
# endif
#endif
#include <complex.h>
#endif /* !defined(NCOMPLEX) */

Expand Down

0 comments on commit 3450df0

Please sign in to comment.