diff --git a/cpppetsc/test/LeastSquaresSolver_Test.cc b/cpppetsc/test/LeastSquaresSolver_Test.cc
index a5a7d4e147a39fa8c226008f66374eec675e2677..62a50bdac3b3757c499328395bde9de69386b92e 100644
--- a/cpppetsc/test/LeastSquaresSolver_Test.cc
+++ b/cpppetsc/test/LeastSquaresSolver_Test.cc
@@ -13,6 +13,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#ifndef AE108_PETSC_COMPLEX
+
 #include "ae108/cpppetsc/LeastSquaresSolver.h"
 #include "ae108/cpppetsc/ParallelComputePolicy.h"
 #include "ae108/cpppetsc/SequentialComputePolicy.h"
@@ -86,3 +88,5 @@ TYPED_TEST(LeastSquaresSolver_Test,
 } // namespace
 } // namespace cpppetsc
 } // namespace ae108
+
+#endif
\ No newline at end of file
diff --git a/solve/src/include/ae108/solve/LeastSquaresSolver.h b/solve/src/include/ae108/solve/LeastSquaresSolver.h
index a3614db8e454195199dade8e5628380069f39d17..f344fea70c29c12050f8e30a71b2298855347ca6 100644
--- a/solve/src/include/ae108/solve/LeastSquaresSolver.h
+++ b/solve/src/include/ae108/solve/LeastSquaresSolver.h
@@ -15,6 +15,8 @@
 
 #pragma once
 
+#ifndef AE108_PETSC_COMPLEX
+
 #include "ae108/assembly/AssemblerTypeTraits.h"
 #include "ae108/cpppetsc/LeastSquaresSolver.h"
 #include "ae108/cpppetsc/MeshBoundaryCondition.h"
@@ -260,3 +262,5 @@ LeastSquaresSolver<Assembler>::computeSolution(
 
 } // namespace solve
 } // namespace ae108
+
+#endif
\ No newline at end of file
diff --git a/solve/test/LeastSquaresSolver_Test.cc b/solve/test/LeastSquaresSolver_Test.cc
index b2a7058def2d3d2e824cd3477e598b1a2f6035c1..cdd2b764ead1efbe44c80d2f06b88afd8578d6e6 100644
--- a/solve/test/LeastSquaresSolver_Test.cc
+++ b/solve/test/LeastSquaresSolver_Test.cc
@@ -13,6 +13,8 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+#ifndef AE108_PETSC_COMPLEX
+
 #include "ae108/cpppetsc/ParallelComputePolicy.h"
 #include "ae108/cpppetsc/SequentialComputePolicy.h"
 #include "ae108/cpppetsc/Vector.h"
@@ -95,3 +97,5 @@ TYPED_TEST(LeastSquaresSolver_Test, bc_solve_works) {
 } // namespace
 } // namespace solve
 } // namespace ae108
+
+#endif
\ No newline at end of file