1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

Merge pull request #29455 from anushkagupta200615-jpg:fix-issue-29452

Fix #29452: Remove <complex.h> to prevent _Complex macro conflicts #29455

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake

---

**Description:**
Resolves https://github.com/opencv/opencv/issues/29452

**Reason for the issue:**
The C99 `<complex.h>` header defines the macro `complex` on some platforms (like NetBSD with GCC 14). Because it was included before C++ `<complex>`, this caused conflicts where `std::complex<T>` was being expanded into `std::_Complex<T>`, resulting in the reported syntax errors.

**Changes made:**
- Removed the unnecessary C-style `#include <complex.h>`.
- Added a safety guard to `#undef complex` in case any transitive lapack headers attempt to define it, ensuring `std::complex` works cleanly without C-preprocessor interference.
This commit is contained in:
Anushka
2026-07-07 17:50:09 +05:30
committed by GitHub
parent aa70c82ebe
commit d48bf69f65
+1 -2
View File
@@ -47,7 +47,6 @@
#ifdef HAVE_LAPACK
#include <complex.h>
#include "opencv_lapack.h"
#include <cmath>
@@ -710,4 +709,4 @@ int lapack_gemm64fc(const double *src1, size_t src1_step, const double *src2, si
#pragma clang diagnostic pop
#endif
#endif //HAVE_LAPACK
#endif //HAVE_LAPACK