diff --git a/simple-cam.cpp b/simple-cam.cpp
index 95e472b4377a..350f68be7906 100644
--- a/simple-cam.cpp
+++ b/simple-cam.cpp
@@ -16,8 +16,8 @@
 #define TIMEOUT_SEC 3
 
 using namespace libcamera;
-std::shared_ptr<Camera> camera;
-EventLoop loop;
+static std::shared_ptr<Camera> camera;
+static EventLoop loop;
 
 /*
  * --------------------------------------------------------------------
