I have some code working in OpenGL and now I would like to use ImGui to make a GUI for my application.
When I tried to copy a one line code of ImGui to my project ImGui::CreateContext();
by including some of the header files of ImGui
, it lasted by a hundred errors (due maybe to linking).
I'm working with Ubuntu 18 and I use a Makefile to compile the whole project
Some of the errors that I got when including imgui.h
:
imgui/imgui.h:153:39: error: unknown type name ‘ImGuiInputTextCallbackData’; did you mean ‘ImGuiInputTextFlags’?
typedef int (*ImGuiInputTextCallback)(ImGuiInputTextCallbackData *data);
^~~~~~~~~~~~~~~~~~~~~~~~~~
ImGuiInputTextFlags
imgui/imgui.h:154:35: error: unknown type name ‘ImGuiSizeCallbackData’
typedef void (*ImGuiSizeCallback)(ImGuiSizeCallbackData* data);
^~~~~~~~~~~~~~~~~~~~~
imgui/imgui.h:179:5: error: expected specifier-qualifier-list before ‘ImVec2’
ImVec2() { x = y = 0.0f; }
^~~~~~
imgui/imgui.h:192:5: error: expected specifier-qualifier-list before ‘ImVec4’
ImVec4() { x = y = z = w = 0.0f; }
^~~~~~
imgui/imgui.h:204:1: error: unknown type name ‘namespace’; did you mean ‘isspace’?
namespace ImGui
^~~~~~~~~
isspace
imgui/imgui.h:205:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
{
^
In file included from window.c:23:0:
imgui/imgui.h:1200:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘new’
inline void* operator new(size_t, ImNewDummy, void* ptr) { return ptr; }
^~~
imgui/imgui.h:1201:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘delete’
inline void operator delete(void*, ImNewDummy, void*) {} // This is only required so we can use the symmetrical new()
^~~~~~
imgui/imgui.h:1206:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
template<typename T> void IM_DELETE(T* p) { if (p) { p->~T(); ImGui::MemFree(p); } }
^
imgui/imgui.h:1217:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
template<typename T>
^
imgui/imgui.h:1280:5: error: unknown type name ‘ImVec2’
ImVec2 WindowPadding; // Padding within a window.
When I run some examples that are provided, they work perfectly. However, when trying to merge my project with a single line of code of imgui, it ends up with the errors shown above.