diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index d5cb83c5f..ed36b4d45 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -2910,7 +2910,7 @@ void GLCanvas3D::Gizmos::render_overlay(const GLCanvas3D& canvas, const GLCanvas
     ::glPopMatrix();
 }
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
 void GLCanvas3D::Gizmos::create_external_gizmo_widgets(wxWindow *parent)
 {
     for (auto &entry : m_gizmos) {
@@ -3333,7 +3333,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
     , m_moving(false)
     , m_color_by("volume")
     , m_reload_delayed(false)
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
     , m_external_gizmo_widgets_parent(nullptr)
 #endif // not ENABLE_IMGUI
 {
@@ -3443,7 +3443,7 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
             return false;
         }
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
         if (m_external_gizmo_widgets_parent != nullptr) {
             m_gizmos.create_external_gizmo_widgets(m_external_gizmo_widgets_parent);
             m_canvas->GetParent()->Layout();
@@ -3714,7 +3714,7 @@ void GLCanvas3D::update_volumes_colors_by_extruder()
 
 // Returns a Rect object denoting size and position of the Reset button used by a gizmo.
 // Returns in either screen or viewport coords.
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
 Rect GLCanvas3D::get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const
 {
     const Size& cnv_size = canvas.get_canvas_size();
@@ -4575,7 +4575,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
                 m_dirty = true;
             }
         }
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
         else if ((m_gizmos.get_current_type() == Gizmos::SlaSupports) && gizmo_reset_rect_contains(*this, pos(0), pos(1)))
         {
             if (evt.LeftDown())
@@ -4986,7 +4986,7 @@ void GLCanvas3D::set_tooltip(const std::string& tooltip) const
     }
 }
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
 void GLCanvas3D::set_external_gizmo_widgets_parent(wxWindow *parent)
 {
     m_external_gizmo_widgets_parent = parent;
diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp
index d67beb3c6..c009247ec 100644
--- a/src/slic3r/GUI/GLCanvas3D.hpp
+++ b/src/slic3r/GUI/GLCanvas3D.hpp
@@ -638,7 +638,7 @@ private:
 
         void render_overlay(const GLCanvas3D& canvas, const Selection& selection) const;
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
         void create_external_gizmo_widgets(wxWindow *parent);
 #endif // not ENABLE_IMGUI
 
@@ -734,7 +734,7 @@ private:
 
     GCodePreviewVolumeIndex m_gcode_preview_volume_index;
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
     wxWindow *m_external_gizmo_widgets_parent;
 #endif // not ENABLE_IMGUI
 
@@ -814,7 +814,7 @@ public:
 
     void update_volumes_colors_by_extruder();
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
     Rect get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const;
     bool gizmo_reset_rect_contains(const GLCanvas3D& canvas, float x, float y) const;
 #endif // not ENABLE_IMGUI
@@ -860,7 +860,7 @@ public:
 
     void set_tooltip(const std::string& tooltip) const;
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
     void set_external_gizmo_widgets_parent(wxWindow *parent);
 #endif // not ENABLE_IMGUI
 
diff --git a/src/slic3r/GUI/GLGizmo.cpp b/src/slic3r/GUI/GLGizmo.cpp
index 36c0cc3bb..8d22baac5 100644
--- a/src/slic3r/GUI/GLGizmo.cpp
+++ b/src/slic3r/GUI/GLGizmo.cpp
@@ -272,7 +272,7 @@ void GLGizmoBase::render_grabbers_for_picking(const BoundingBoxf3& box) const
     }
 }
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
 void GLGizmoBase::create_external_gizmo_widgets(wxWindow *parent) {}
 #endif // not ENABLE_IMGUI
 
@@ -1660,7 +1660,7 @@ void GLGizmoSlaSupports::on_render(const GLCanvas3D::Selection& selection) const
     //::glTranslatef((GLfloat)dragged_offset(0), (GLfloat)dragged_offset(1), (GLfloat)dragged_offset(2));
     render_grabbers(false);
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
     render_tooltip_texture();
 #endif // not ENABLE_IMGUI
     ::glDisable(GL_BLEND);
@@ -1865,7 +1865,7 @@ void GLGizmoSlaSupports::on_update(const UpdateData& data)
     }
 }
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
 void GLGizmoSlaSupports::render_tooltip_texture() const {
     if (m_tooltip_texture.get_id() == 0)
         if (!m_tooltip_texture.load_from_file(resources_dir() + "/icons/sla_support_points_tooltip.png", false))
@@ -1986,7 +1986,7 @@ const std::array<float, 3> GLGizmoCut::GrabberColor = { 1.0, 0.5, 0.0 };
 GLGizmoCut::GLGizmoCut(GLCanvas3D& parent)
     : GLGizmoBase(parent)
     , m_cut_z(0.0)
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
     , m_panel(nullptr)
 #endif // not ENABLE_IMGUI
     , m_keep_upper(true)
@@ -1994,7 +1994,7 @@ GLGizmoCut::GLGizmoCut(GLCanvas3D& parent)
     , m_rotate_lower(false)
 {}
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
 void GLGizmoCut::create_external_gizmo_widgets(wxWindow *parent)
 {
     wxASSERT(m_panel == nullptr);
@@ -2053,7 +2053,7 @@ void GLGizmoCut::on_set_state()
         m_cut_z = m_parent.get_selection().get_bounding_box().size()(2) / 2.0;
     }
 
-#ifndef ENABLE_IMGUI
+#if !ENABLE_IMGUI
     // Display or hide the extra panel
     if (m_panel != nullptr) {
         m_panel->display(get_state() == On);
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index f2f4d8643..53d06aee7 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -60,7 +60,9 @@ IMPLEMENT_APP(GUI_App)
 
 GUI_App::GUI_App()
     : wxApp()
+#if ENABLE_IMGUI
     , m_imgui(new ImGuiWrapper())
+#endif // ENABLE_IMGUI
 {}
 
 bool GUI_App::OnInit()