epezent / epezent/implot

[Bug] Using -DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)" will let the demo fail to link

Open
#715 0 comments 0 reactions 1 assignee Claimed by @brenocq View on GitHub
prio:high status:todo type:fix
Dominant language
C++
Stars
6.2k
Forks
693
PR merge metrics
No merged PRs in 30d

Description

**Bug description**
When I try to reduce the object size of implot.cpp.o from 242MB to something lower, I was trying to use IMPLOT_CUSTOM_NUMERIC_TYPES to limit the data type support to float and double - but using this will let the demo code fail to link. Maybe there is a way to check for a type being available via preprocessor and just omit those parts of the demo that are disabled because the data type is not supported?

```
/usr/bin/ld: src/tests/testimgui/CMakeFiles/testimgui.dir/implot_demo.cpp.o: in function `ImPlot::Demo_BarPlots()':
src/tests/testimgui/implot_demo.cpp:548:(.text+0x7ab8): undefined reference to `void ImPlot::PlotBars(char const*, signed char const*, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/implot_demo.cpp:549:(.text+0x7b9e): undefined reference to `void ImPlot::PlotBars(char const*, signed char const*, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/CMakeFiles/testimgui.dir/implot_demo.cpp.o: in function `ImPlot::Demo_BarGroups()':
src/tests/testimgui/implot_demo.cpp:585:(.text+0x8004): undefined reference to `void ImPlot::PlotBarGroups(char const* const*, signed char const*, int, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/implot_demo.cpp:590:(.text+0x8150): undefined reference to `void ImPlot::PlotBarGroups(char const* const*, signed char const*, int, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/CMakeFiles/testimgui.dir/implot_demo.cpp.o: in function `ImPlot::Demo_BarStacks()':
src/tests/testimgui/implot_demo.cpp:638:(.text+0x854c): undefined reference to `void ImPlot::PlotBarGroups(char const* const*, int const*, int, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/implot_demo.cpp:640:(.text+0x858b): undefined reference to `void ImPlot::PlotBarGroups(char const* const*, int const*, int, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/CMakeFiles/testimgui.dir/implot_demo.cpp.o: in function `ImPlot::Demo_PieCharts()':
src/tests/testimgui/implot_demo.cpp:744:(.text+0xa6d9): undefined reference to `void ImPlot::PlotPieChart(char const* const*, int const*, int, double, double, double, char const*, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/CMakeFiles/testimgui.dir/implot_demo.cpp.o: in function `ImPlot::Demo_MarkersAndText()':
src/tests/testimgui/implot_demo.cpp:1090:(.text+0x104fc): undefined reference to `void ImPlot::PlotLine(char const*, signed char const*, signed char const*, int, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/implot_demo.cpp:1099:(.text+0x106e9): undefined reference to `void ImPlot::PlotLine(char const*, signed char const*, signed char const*, int, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/CMakeFiles/testimgui.dir/implot_demo.cpp.o: in function `ImPlot::Demo_PerIndexColors()':
src/tests/testimgui/implot_demo.cpp:1375:(.text+0x17839): undefined reference to `void ImPlot::PlotBars(char const*, signed char const*, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/implot_demo.cpp:1379:(.text+0x1793d): undefined reference to `void ImPlot::PlotBars(char const*, signed char const*, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/CMakeFiles/testimgui.dir/implot_demo.cpp.o: in function `ImPlot::Demo_LinkedAxes()':
src/tests/testimgui/implot_demo.cpp:1656:(.text+0x1daa0): undefined reference to `void ImPlot::PlotLine(char const*, int const*, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/implot_demo.cpp:1662:(.text+0x1ddf1): undefined reference to `void ImPlot::PlotLine(char const*, int const*, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/CMakeFiles/testimgui.dir/implot_demo.cpp.o: in function `ImPlot::Demo_CustomStyles()':
src/tests/testimgui/implot_demo.cpp:2593:(.text+0x32303): undefined reference to `void ImPlot::PlotBars(char const*, unsigned int const*, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/implot_demo.cpp:2594:(.text+0x323d3): undefined reference to `void ImPlot::PlotLine(char const*, unsigned int const*, int, double, double, ImPlotSpec const&)'
/usr/bin/ld: src/tests/testimgui/implot_demo.cpp:2596:(.text+0x324be): undefined reference to `void ImPlot::PlotScatter(char const*, unsigned int const*, int, double, double, ImPlotSpec const&)'
collect2: error: ld returned 1 exit status
```

Something like this might work - even though I don't like it that much. But I wasn't able to find any other solution because you can't emit a `#define` from within a macro

[patch.txt](https://github.com/user-attachments/files/31016606/patch.txt)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.