Repository: ocornut/imgui (language: rust)

Issue:
Compilation issue  example_glut_opengl2
**System:** 
Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 GNU/Linux

**Compiler:** 
g++ (GCC) 11.3.0

**Issue:**
Compiling **example_glut_opengl2**

Running 'make' fails:

![image](https://user-images.githubusercontent.com/1634408/233824556-26c48c67-7a5e-44fc-9478-49b8a660253d.png)

g++ -std=c++11 -I../.. -I../../backends -g -Wall -Wformat -c -o main.o main.cpp
main.cpp: In function 'void MainLoopStep()':
main.cpp:135:79: error: 'io' was not declared in this scope
  135 |         ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
      |                                                                               ^~
make: *** [Makefile:60: main.o] Error 1


Fixed  in PR #6361 




Discussion / hints:

Fix patch:
diff --git a/examples/example_glut_opengl2/main.cpp b/examples/example_glut_opengl2/main.cpp
index b7a07e8bf62d..fff9043c6e33 100644
--- a/examples/example_glut_opengl2/main.cpp
+++ b/examples/example_glut_opengl2/main.cpp
@@ -108,6 +108,7 @@ void MainLoopStep()
     ImGui_ImplOpenGL2_NewFrame();
     ImGui_ImplGLUT_NewFrame();
     ImGui::NewFrame();
+    ImGuiIO& io = ImGui::GetIO();
 
     // 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
     if (show_demo_window)
@@ -148,7 +149,6 @@ void MainLoopStep()
 
     // Rendering
     ImGui::Render();
-    ImGuiIO& io = ImGui::GetIO();
     glViewport(0, 0, (GLsizei)io.DisplaySize.x, (GLsizei)io.DisplaySize.y);
     glClearColor(clear_color.x * clear_color.w, clear_color.y * clear_color.w, clear_color.z * clear_color.w, clear_color.w);
     glClear(GL_COLOR_BUFFER_BIT);


Test patch: