title: Compiling ImGui in C++
body: <p>On <a href="https://github.com/ocornut/imgui" rel="nofollow noreferrer">https://github.com/ocornut/imgui</a> it says: <code>No specific build process is required. You can add the .cpp files to your existing project.</code> I tried this using Code Blocks with the relevant <code>.cpp</code> files, however it gives me about 500+ <code>Undefined Reference to ... errors</code>. The first beginning in <code>imgui.cpp</code> being <code>|1994|undefined reference to `ImGui::InputText(char const*, char*, unsigned long, int, int (*)(ImGuiInputTextCallbackData*), void*)'</code>. This is the following code I tried.</p>
  <pre><code>#include &quot;imgui.h&quot;
  
  
  
  int main()
  {
  
      bool my_tool_active = true;
      float my_color = 0.5;
  
  
      // Create a window called &quot;My First Tool&quot;, with a menu bar.
      ImGui::Begin(&quot;My First Tool&quot;, &amp;my_tool_active, ImGuiWindowFlags_MenuBar);
      if (ImGui::BeginMenuBar())
      {
          if (ImGui::BeginMenu(&quot;File&quot;))
          {
              if (ImGui::MenuItem(&quot;Open..&quot;, &quot;Ctrl+O&quot;)) { /* Do stuff */ }
              if (ImGui::MenuItem(&quot;Save&quot;, &quot;Ctrl+S&quot;))   { /* Do stuff */ }
              if (ImGui::MenuItem(&quot;Close&quot;, &quot;Ctrl+W&quot;))  { my_tool_active = false; }
              ImGui::EndMenu();
          }
          ImGui::EndMenuBar();
      }
  
      // Edit a color (stored as ~4 floats)
      ImGui::ColorEdit4(&quot;Color&quot;, &amp;my_color);
  
      // Plot some values
      const float my_values[] = { 0.2f, 0.1f, 1.0f, 0.5f, 0.9f, 2.2f };
      ImGui::PlotLines(&quot;Frame Times&quot;, my_values, IM_ARRAYSIZE(my_values));
  
      // Display contents in a scrolling region
      ImGui::TextColored(ImVec4(1,1,0,1), &quot;Important Stuff&quot;);
      ImGui::BeginChild(&quot;Scrolling&quot;);
      for (int n = 0; n &lt; 50; n++)
          ImGui::Text(&quot;%04d: Some text&quot;, n);
      ImGui::EndChild();
      ImGui::End();
  
  
      return 0;
  }
  
  </code></pre>
  <p>What am I missing? I can't find any linker commands on the webpage which (in my experience &quot;undefined reference to...&quot; is usually a result of missing linker options)</p>