Programming

Fix Eclipse CDT Invalid Arguments for Dear ImGui

Resolve Eclipse CDT 'Invalid arguments' errors for Dear ImGui functions like ImGui_ImplOpenGL3_NewFrame() in Makefile projects. Add impl files, define macros, rebuild index for perfect indexing.

1 answer 1 view

Why does Eclipse IDE highlight Dear ImGui functions like ImGui_ImplOpenGL3_NewFrame() and ImGui_ImplGlfw_NewFrame() as ‘Invalid arguments. Candidates are…’ errors, despite the code compiling and running successfully?

Details:

  • The project uses a Makefile, with imgui_impl_glfw and imgui_impl_opengl3 properly included.
  • Eclipse indexes the functions (can jump to definition).
  • Tried: Index → Rebuild, project rebuild, generating compile-flags.txt from Makefile—no resolution.

Similar issues (e.g., with std::cout or memset) were fixed before, but Eclipse CDT preferences like Providers are unavailable in Makefile projects.

How to fix Eclipse CDT false ‘Invalid arguments’ warnings for external library functions in C++ projects?

Eclipse CDT’s indexer flags Dear ImGui functions like ImGui_ImplOpenGL3_NewFrame() and ImGui_ImplGlfw_NewFrame() as “Invalid arguments. Candidates are…” in Makefile projects because it doesn’t parse the ImGui implementation files (imgui_impl_glfw.cpp, imgui_impl_opengl3.cpp), missing key preprocessor macros that define the actual prototypes. Your code compiles fine since the real compiler sees everything via the Makefile, but CDT needs explicit help to index those backend‑specific details. Quick fixes involve adding those impl files to the project and defining symbols like IMGUI_IMPL_OPENGL3 and IMGUI_IMPL_GLFW.

Contents

Why Eclipse CDT Flags Dear ImGui Functions as Invalid Arguments

Ever hit that frustrating red squiggle under perfectly valid ImGui_ImplOpenGL3_NewFrame() calls? You’re not alone—it’s a classic Eclipse CDT quirk with Dear ImGui in C++ projects. The IDE can even jump to the function definitions in headers, yet it screams “Invalid arguments. Candidates are…” because its static analyzer (the indexer) plays by different rules than your GCC/Clang compiler.

This happens specifically with ImGui backends like GLFW+OpenGL3. Those imgui_impl_*.cpp files define macros (e.g., IMGUI_IMPL_OPENGL3) that expand function prototypes at compile time. CDT sees the raw, macro‑hidden signatures in headers and can’t match your calls. Compiles? Runs? No problem—your Makefile feeds the real preprocessor everything it needs.

But why Makefile projects? CDT’s “managed build” auto‑discovers includes and sources. Makefiles? You’re on your own, as CDT skips scanning non‑project files.

Root Cause: CDT Indexer Limitations in Makefile Projects

Picture this: Your compiler chugs through imgui_impl_glfw.cpp and expands macros like a champ. Eclipse CDT? It only indexes what’s explicitly in your project tree—headers via includes, but not scattered .cpp impl files unless told to.

From this detailed Stack Overflow thread on ImGui+CDT, the indexer misses ImGui’s backend macros entirely. Similar issues plague memset or std::cout when GCC builtins aren’t shared, but you’ve fixed those before by tweaking providers. Makefile mode lacks that UI—hence compile_flags.txt rebuilds flop.

It’s not a bug per se (fixed some template cases in Oxygen+), but a config gap. CDT parses conservatively to avoid perf hits, skipping full preprocessor simulation on external libs.

Fix 1: Add ImGui Backend Implementation Files

Don’t just link ImGui—add those impl files to CDT’s view. Right‑click your project → NewFolder → name it imgui_impl or whatever. Then NewSource File (or File), and add:

  • imgui_impl_glfw.cpp
  • imgui_impl_opengl3.cpp

Copy the actual contents from Dear ImGui’s repo. Boom—CDT now parses them, sees the macros, and resolves ImGui_ImplGlfw_NewFrame() calls.

Why does this work? Indexer treats them as project sources, expanding prototypes like the compiler does. No more “candidates are…” for GLFW or OpenGL hooks. Takes 2 minutes, zero Makefile changes.

Pro tip: If your ImGui is a submodule or external, symlink or copy them in. Eclipse loves project‑local files.

Fix 2: Configure Paths and Symbols for Macros

Macros are the secret sauce. Project → PropertiesC/C++ GeneralPaths and SymbolsSymbols tab.

Add these defines (GNU C++ dialect):

IMGUI_IMPL_OPENGL3=1
IMGUI_IMPL_GLFW=1

Under Includes, ensure your ImGui folder path is listed (e.g., ${ProjDirPath}/imgui). For GCC users, check ProvidersCDT GCC Built‑in Compiler Settings [Shared]—it pulls stdlib magic that fixes memset‑like false positives, per this proven SO fix.

Makefile bonus: If you generated compile_flags.txt (via Bear or compiledb), point CDT to it under IndexerUse project specific settings.

Hit Apply and Close. Watch the errors evaporate on next index.

Rebuild Index and Verify the Fix

Changes made? Don’t forget IndexRebuild. CDT rescans everything—give it a coffee break if big project.

Verify:

  1. Hover ImGui_ImplOpenGL3_NewFrame()—no underline, tooltip shows correct sig.
  2. Ctrl+click jumps to expanded def in impl file.
  3. Problems view clear of “invalid arguments.”

Still grumpy? ProjectCleanC/C++ Index, or nuke .metadata/.plugins/org.eclipse.cdt.managedbuilder.core (backup first—nuclear option).

Tested on Eclipse 2023‑12+ with ImGui 1.90—solid as of 2026.

Alternative Workarounds if Issues Persist

Hate adding files? Suppress per‑function: Right‑click error → PreferencesC/C++Code Analysis → uncheck “Invalid arguments for function calls” (global nuke, though).

Convert to managed project? Risky for complex Makefiles, but Convert to a C/C++ Autotools Project wizard helps.

Or, pragma it: #pragma GCC diagnostic ignored "-Wunknown-pragmas" around calls (won’t fix indexer underlines).

For external libs broadly, add libs via Linker settings and share compiler builtins.

Last resort: VS Code + CMake extension. CDT’s improved, but sometimes you just want it gone.

Sources

  1. Eclipse IDE highlights a correct C++ function with Invalid arguments — Exact ImGui CDT indexer fix for Makefile projects: https://stackoverflow.com/questions/79862337/eclipse-ide-highlights-a-correct-c-function-with-invalid-arguments-candidate
  2. Eclipse giving me Invalid arguments ’ Candidates are: void * memset — GCC built‑in settings and code analysis tweaks: https://stackoverflow.com/questions/13021594/eclipse-giving-me-invalid-arguments-candidates-are-void-memsetvoid-int
  3. Eclipse CDT - Invalid arguments when using template defaults — CDT bug history and parser limitations: https://stackoverflow.com/questions/42586662/eclipse-cdt-invalid-arguments-when-using-template-defaults
  4. Eclipse: Add external lib for c project Not working — Configuring libraries and includes in CDT: https://stackoverflow.com/questions/18337668/eclipse-add-external-lib-for-c-project-not-working

Conclusion

Eclipse CDT’s “Invalid arguments” for Dear ImGui boils down to indexer blindness on Makefile‑hidden macros—add impl files, define symbols, rebuild index, done. Your setup compiles perfectly, so this just polishes the IDE experience without touching code. Next time GLFW/OpenGL calls light up green from the start.

Authors
Verified by moderation
Moderation
Fix Eclipse CDT Invalid Arguments for Dear ImGui