diff --git a/src/accelerator_kokkos.h b/src/accelerator_kokkos.h
index 0c9c121568499743130d6b085fdca5dbb8f85de0..ecba20da653003f2aac4878cb5c80b37e985c4ed 100644
--- a/src/accelerator_kokkos.h
+++ b/src/accelerator_kokkos.h
@@ -43,6 +43,7 @@ class KokkosLMP {
  public:
   int kokkos_exists;
   int num_threads;
+  int ngpu;
   int numa;
 
   KokkosLMP(class LAMMPS *, int, char **) {kokkos_exists = 0;}
diff --git a/src/finish.cpp b/src/finish.cpp
index 8670987573d13d86c3474669de715153bd4c2f3a..3ab4fd0cb71583f1f53de2cf7e0b7f7c2cd7e1c1 100644
--- a/src/finish.cpp
+++ b/src/finish.cpp
@@ -13,6 +13,7 @@
 
 #include <mpi.h>
 #include <math.h>
+#include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include "finish.h"
@@ -517,7 +518,7 @@ void Finish::end(int flag)
 #endif
 
   if (lmp->kokkos && lmp->kokkos->ngpu > 0)
-    if (const char* env_clb = std::getenv("CUDA_LAUNCH_BLOCKING"))
+    if (const char* env_clb = getenv("CUDA_LAUNCH_BLOCKING"))
       if (!(strcmp(env_clb,"1") == 0)) {
         error->warning(FLERR,"Timing breakdown may not be accurate since GPU/CPU overlap is enabled. "
           "Using 'export CUDA_LAUNCH_BLOCKING=1' will give an accurate timing breakdown but will reduce performance");