diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb23d478dd6fc3e8825d6ad9ffec7685f5af1edc..85525ce1d0efa682411e5d295353802453b95d55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2118,7 +2118,7 @@ if(NOT DISABLE_GMSH_TESTS)
         endif()
         set_target_properties(${TEST} PROPERTIES LINK_FLAGS "${FLAGS}")
       endif()
-      add_test(${TEST}_cpp ${TEST})
+      add_test(${TEST}_cpp ${TEST} -nopopup)
     endforeach()
   endif()
   # enable this once we have worked out the path issues on the build machines
diff --git a/tutorial/c++/t4.cpp b/tutorial/c++/t4.cpp
index c678860ed5ebd687b54b43d78937e799563e0ce2..54a2d67e7215c11d8b1a46464656df2ca3c52065 100644
--- a/tutorial/c++/t4.cpp
+++ b/tutorial/c++/t4.cpp
@@ -6,7 +6,7 @@
 //
 // -----------------------------------------------------------------------------
 
-#include <algorithm>
+#include <set>
 #include <math.h>
 #include <gmsh.h>
 
@@ -168,9 +168,9 @@ int main(int argc, char **argv)
   gmsh::write("t4.msh");
 
   // Launch the GUI to see the results:
-  std::vector<std::string> args(argv + 1, argv + argc);
-  if(!std::count(args.begin(), args.end(), "-nopopup"))
-    gmsh::fltk::run();
+  std::set<std::string> args;
+  for(int i = 1; i < argc; i++) args.insert(argv[i]);
+  if(args.find("-nopopup") == args.end()) gmsh::fltk::run();
 
   gmsh::finalize();
   return 0;
diff --git a/tutorial/c++/t7.cpp b/tutorial/c++/t7.cpp
index abf18cd5e20a20cb23a22c230c69d73793a92fcc..777a2db8713bd82c64565f4554a6d697df6a6900 100644
--- a/tutorial/c++/t7.cpp
+++ b/tutorial/c++/t7.cpp
@@ -6,7 +6,7 @@
 //
 // -----------------------------------------------------------------------------
 
-#include <algorithm>
+#include <set>
 #include <gmsh.h>
 
 // Mesh sizes can be specified very accurately by providing a background mesh,
@@ -65,9 +65,9 @@ int main(int argc, char **argv)
   gmsh::write("t7.msh");
 
   // Launch the GUI to see the results:
-  std::vector<std::string> args(argv + 1, argv + argc);
-  if(!std::count(args.begin(), args.end(), "-nopopup"))
-    gmsh::fltk::run();
+  std::set<std::string> args;
+  for(int i = 1; i < argc; i++) args.insert(argv[i]);
+  if(args.find("-nopopup") == args.end()) gmsh::fltk::run();
 
   gmsh::finalize();
   return 0;
diff --git a/tutorial/c++/t8.cpp b/tutorial/c++/t8.cpp
index 132333fedb94c869f583e9e00526d19b53507283..8b445c95b609c153693d9fc8830f61ad11002053 100644
--- a/tutorial/c++/t8.cpp
+++ b/tutorial/c++/t8.cpp
@@ -6,7 +6,7 @@
 //
 // -----------------------------------------------------------------------------
 
-#include <algorithm>
+#include <set>
 #include <gmsh.h>
 
 // In addition to creating geometries and meshes, the C++ API can also be used
@@ -73,9 +73,9 @@ int main(int argc, char **argv)
   gmsh::option::setNumber("General.SmallAxes", 0);
 
   // Show the GUI
-  std::vector<std::string> args(argv + 1, argv + argc);
-  if(!std::count(args.begin(), args.end(), "-nopopup"))
-    gmsh::fltk::initialize();
+  std::set<std::string> args;
+  for(int i = 1; i < argc; i++) args.insert(argv[i]);
+  if(args.find("-nopopup") == args.end()) gmsh::fltk::initialize();
 
   // We also set some options for each post-processing view:
   gmsh::option::setNumber("View[0].IntervalsType", 2);
@@ -164,8 +164,7 @@ int main(int argc, char **argv)
     }
   }
 
-  if(!std::count(args.begin(), args.end(), "-nopopup"))
-    gmsh::fltk::run();
+  if(args.find("-nopopup") == args.end()) gmsh::fltk::run();
 
   gmsh::finalize();
 
diff --git a/tutorial/c++/t9.cpp b/tutorial/c++/t9.cpp
index 9bf8142dc0df8f3f5ab911b795bf4291b225bd7b..cab6ffdfd677d75701dc97ab6d365511fc107459 100644
--- a/tutorial/c++/t9.cpp
+++ b/tutorial/c++/t9.cpp
@@ -15,7 +15,7 @@
 // namespace, or from the graphical interface (right click on the view button,
 // then `Plugins').
 
-#include <algorithm>
+#include <set>
 #include <gmsh.h>
 
 int main(int argc, char **argv)
@@ -76,9 +76,9 @@ int main(int argc, char **argv)
   gmsh::option::setNumber("View[2].IntervalsType", 2);
 
   // show the GUI at the end
-  std::vector<std::string> args(argv + 1, argv + argc);
-  if(!std::count(args.begin(), args.end(), "-nopopup"))
-    gmsh::fltk::run();
+  std::set<std::string> args;
+  for(int i = 1; i < argc; i++) args.insert(argv[i]);
+  if(args.find("-nopopup") == args.end()) gmsh::fltk::run();
 
   gmsh::finalize();
   return 0;
diff --git a/tutorial/c++/x3.cpp b/tutorial/c++/x3.cpp
index 2b07534c30a2326a04a3dc69e958743f4e66f87b..114c92cd264ad96a706c787d918620765d06f51e 100644
--- a/tutorial/c++/x3.cpp
+++ b/tutorial/c++/x3.cpp
@@ -6,7 +6,7 @@
 //
 // -----------------------------------------------------------------------------
 
-#include <algorithm>
+#include <set>
 #include <gmsh.h>
 
 int main(int argc, char **argv)
@@ -142,9 +142,9 @@ int main(int argc, char **argv)
   gmsh::option::setNumber("View[1].MaxRecursionLevel", 5);
 
   // Launch the GUI to see the results:
-  std::vector<std::string> args(argv + 1, argv + argc);
-  if(!std::count(args.begin(), args.end(), "-nopopup"))
-    gmsh::fltk::run();
+  std::set<std::string> args;
+  for(int i = 1; i < argc; i++) args.insert(argv[i]);
+  if(args.find("-nopopup") == args.end()) gmsh::fltk::run();
 
   gmsh::finalize();
   return 0;
diff --git a/tutorial/c++/x4.cpp b/tutorial/c++/x4.cpp
index 484020d85a8e0cf9f92ef1bdd558ef0fc9d9c461..214aff563d711fb2890cb5af13dd49c74814c03d 100644
--- a/tutorial/c++/x4.cpp
+++ b/tutorial/c++/x4.cpp
@@ -6,7 +6,7 @@
 //
 // -----------------------------------------------------------------------------
 
-#include <algorithm>
+#include <set>
 #include <gmsh.h>
 
 int main(int argc, char **argv)
@@ -92,9 +92,9 @@ int main(int argc, char **argv)
   gmsh::view::write(t2, "x4_t2.msh");
 
   // Launch the GUI to see the results:
-  std::vector<std::string> args(argv + 1, argv + argc);
-  if(!std::count(args.begin(), args.end(), "-nopopup"))
-    gmsh::fltk::run();
+  std::set<std::string> args;
+  for(int i = 1; i < argc; i++) args.insert(argv[i]);
+  if(args.find("-nopopup") == args.end()) gmsh::fltk::run();
 
   gmsh::finalize();
   return 0;