Getting errors about including imgui.h when it should just work fine #5981
Replies: 2 comments
-
Hi, please make sure your posts are well-formatted. You need to use three backticks for multi-line codeblocks, IE:
becomes int main()
{
printf("Hello, world!");
} Also the error list shown in the You need to include the headers for the backends too. IE: You should not need to use the
We can't assist you without knowing what the errors are. |
Beta Was this translation helpful? Give feedback.
-
It went wrong Line namespace ImGui
{
// Windows
// We should always have a CurrentWindow in the stack (there is an implicit "Debug" window)
// If this ever crash because g.CurrentWindow is NULL it means that either
// - ImGui::NewFrame() has never been called, which is illegal.
// - You are calling ImGui functions after ImGui::EndFrame()/ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.
inline ImGuiWindow* GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }
inline ImGuiWindow* GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }
IMGUI_API ImGuiWindow* FindWindowByID(ImGuiID id);
IMGUI_API ImGuiWindow* FindWindowByName(const char* name);
IMGUI_API void UpdateWindowParentAndRootLinks(ImGuiWindow* window, ImGuiWindowFlags flags, ImGuiWindow* parent_window);
IMGUI_API void UpdateWindowSkipRefresh(ImGuiWindow* window);
IMGUI_API ImVec2 CalcWindowNextAutoFitSize(ImGuiWindow* window);
IMGUI_API bool IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent, bool popup_hierarchy);
IMGUI_API bool IsWindowWithinBeginStackOf(ImGuiWindow* window, ImGuiWindow* potential_parent);
IMGUI_API bool IsWindowAbove(ImGuiWindow* potential_above, ImGuiWindow* potential_below);
IMGUI_API bool IsWindowNavFocusable(ImGuiWindow* window);
IMGUI_API void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond = 0);
IMGUI_API void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond = 0);
IMGUI_API void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond = 0);
IMGUI_API void SetWindowHitTestHole(ImGuiWindow* window, const ImVec2& pos, const ImVec2& size);
IMGUI_API void SetWindowHiddenAndSkipItemsForCurrentFrame(ImGuiWindow* window); |
Beta Was this translation helpful? Give feedback.
-
Hey all. First time diving into ImGUI and I'm getting a bunch of errors in my main access script (everything is in c++ by the way.)
Here is that script for reference:
`
// PhysicsTest.cpp
#include "simulation.h"
#include "imgui/imgui.h"
#include "SDL/include/SDL_events.h"
#include "SDL/include/SDL_opengl.h"
#include "SDL/include/SDL.h"
#include "SDL/include/SDL_syswm.h"
// Simulation and window variables
PhysicsSimulation simulation;
SDL_Window* window = nullptr;
SDL_GLContext gl_context = nullptr;
// Update function that is called every frame
void update() {
// Calculate the time elapsed between each frame
float deltaTime = ImGui::GetIO().DeltaTime;
}
int main() {
// Initialize SDL
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0) {
printf("Error: %s\n", SDL_GetError());
return -1;
}
}
`
From this script I get the following errors:
Error C2661 'ImGui::RadioButton': no overloaded function takes 1 arguments 23
Error (active) E0140 too many arguments in function call 35
Error (active) E0140 too many arguments in function call 38
Error (active) E0140 too many arguments in function call 41
Error (active) E0020 identifier "ImGui_ImplSDL2_Shutdown" is undefined 118
Error (active) E0020 identifier "ImGui_ImplSDL2_ProcessEvent" is undefined 97
Error (active) E0020 identifier "ImGui_ImplSDL2_NewFrame" is undefined 106
Error (active) E0020 identifier "ImGui_ImplSDL2_InitForOpenGL" is undefined 88
Error (active) E0020 identifier "ImGui_ImplOpenGL3_Shutdown" is undefined 117
Error (active) E0020 identifier "ImGui_ImplOpenGL3_NewFrame" is undefined 105
Error (active) E0020 identifier "ImGui_ImplOpenGL3_Init" is undefined Physics Test C87
Error (active) E0135 class "PhysicsSimulation" has no member "setCurrentMotion" 24
Error (active) E0135 class "PhysicsSimulation" has no member "setCurrentMotion" 27
Error (active) E0135 class "PhysicsSimulation" has no member "setCurrentMotion" 30
Error (active) E0135 class "PhysicsSimulation" has no member "getCurrentMotion" 23
Error (active) E0135 class "PhysicsSimulation" has no member "getCurrentMotion" P26
Error (active) E0135 class "PhysicsSimulation" has no member "getCurrentMotion" 29
Error (active) E0135 class "PhysicsSimulation" has no member "getCurrentMotion" 33
Error C2039 'setCurrentMotion': is not a member of 'PhysicsSimulation' Physics Test 24
Error C2039 'setCurrentMotion': is not a member of 'PhysicsSimulation' Physics Test 27
Error C2039 'setCurrentMotion': is not a member of 'PhysicsSimulation' Physics Test 30
Error C2660 'PhysicsSimulation::gravity': function does not take 1 arguments 38
Error C2660 'PhysicsSimulation::elasticCollision': function does not take 1 arguments 41
Error C2660 'PhysicsSimulation::constantVelocity': function does not take 1 arguments 35
Error C2512 'PhysicsSimulation': no appropriate default constructor available 11
Error C3861 'ImGui_ImplSDL2_Shutdown': identifier not found 118
Error C3861 'ImGui_ImplSDL2_ProcessEvent': identifier not found 97
Error C3861 'ImGui_ImplSDL2_NewFrame': identifier not found 106
Error C3861 'ImGui_ImplSDL2_InitForOpenGL': identifier not found 88
Error C3861 'ImGui_ImplOpenGL3_Shutdown': identifier not found 117
Error C3861 'ImGui_ImplOpenGL3_NewFrame': identifier not found 105
Error C3861 'ImGui_ImplOpenGL3_Init': identifier not found 87
Error C2661 'ImGui::RadioButton': no overloaded function takes 1 arguments 26
Error C2661 'ImGui::RadioButton': no overloaded function takes 1 arguments 29
Error C2039 'getCurrentMotion': is not a member of 'PhysicsSimulation' 23
Error C2039 'getCurrentMotion': is not a member of 'PhysicsSimulation' 26
Error C2039 'getCurrentMotion': is not a member of 'PhysicsSimulation' 29
Error C2039 'getCurrentMotion': is not a member of 'PhysicsSimulation' 33
From all of this there is a bunch of not found identifiers. If I add includes for each of them another issue springs up as it now complains about imgui.h no being found but only on 3 files. Changing it to this: #include "imgui/imgui.h" it fixes itself but then I get an extra 60 errors of random things going haywire. Could anyone assist me in debugging this?
-Thanks
Beta Was this translation helpful? Give feedback.
All reactions