Skip to content

compile fails on ubuntu - missing import cstdint #35

@cobordism

Description

@cobordism

TLDR: Add #include <cstdint> before line 10 of usvg/svgnode.h to fix compilation on Ubuntu

I tried to compile on Ubuntu 25.10 and it fails as follows:

$ make USE_SYSTEM_SDL=1
mkdir -p Release/syncscribble/ Release/syncscribble/../miniz/ Release/syncscribble/../nanovgXC/glad/ Release/syncscribble/../nanovgXC/src/ Release/syncscribble/../pugixml/src/ Release/syncscribble/../ugui/ Release/syncscribble/../ulib/ Release/syncscribble/../usvg/ Release/syncscribble/linux/
g++ -c -pthread -g -MMD -Wall -Wshadow -Werror=return-type -O2 -DNDEBUG -I/usr/include/SDL2 -D_REENTRANT  -DPUGIXML_NO_XPATH -DPUGIXML_NO_EXCEPTIONS -DSCRIBBLE_REV_NUMBER="6f3330c" -DSCRIBBLE_TEST_PATH='"/redacted/Write/syncscribble/../scribbletest"' --std=c++14 -fno-rtti -fno-exceptions -Wno-unused-parameter -Wno-unused-function -Wno-unused  -Werror=conditionally-supported -I. -I.. -I../nanovgXC/src -I../nanovgXC/glad -isystem ../pugixml/src -isystem ../stb  -o Release/syncscribble/application.o application.cpp
In file included from ../usvg/svgpainter.h:2,
                 from application.cpp:2:
../usvg/svgnode.h:202:69: error: ‘SIZE_MAX’ was not declared in this scope
  202 |   std::vector<SvgNode*> select(const char* selector, size_t nhits = SIZE_MAX) const;
      |                                                                     ^~~~~~~~
../usvg/svgnode.h:10:1: note: ‘SIZE_MAX’ is defined in header ‘<cstdint>’; this is probably fixable by adding ‘#include <cstdint>’
    9 | #include "ulib/color.h"  // for Color and Gradient
  +++ |+#include <cstdint>
   10 | 
In file included from ../usvg/svgxml.h:13,
                 from ../usvg/svgparser.h:6,
                 from application.cpp:4:
../ulib/utrace.h: In static member function ‘static void Tracer::flush()’:
../ulib/platformutil.h:74:34: warning: format not a string literal and no format arguments [-Wformat-security]
   74 | #define PLATFORM_LOG(...) fprintf(stderr, __VA_ARGS__)
      |                           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../ulib/utrace.h:27:5: note: in expansion of macro ‘PLATFORM_LOG’
   27 |     PLATFORM_LOG(buff.c_str());
      |     ^~~~~~~~~~~~
make: *** [Makefile.unix:91: Release/syncscribble/application.o] Error 1

It turns out the suggestion is correct. Adding #include <cstdint> to line 10 of usvg/svgnode.h fixes it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions