Skip to content

error: 'uint' has not been declared #882

@ryandesign

Description

@ryandesign

We received a bug report at MacPorts from a user who cannot build tilemaker 3.1.0 on Mac OS X 10.6:

[ 57%] Building CXX object CMakeFiles/tilemaker.dir/src/output_object.cpp.o
/opt/local/bin/g++-mp-14 -DBOOST_ALL_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -I/opt/local/var/macports/build/tilemaker-c46fb254/work/tilemaker-3.1.0/include -I/opt/local/var/macports/build/tilemaker-c46fb254/work/build -isystem /opt/local/include -isystem /opt/local/libexec/boost/1.76/include -pipe -I/opt/local/libexec/boost/1.76/include -Os -DNDEBUG -I/opt/local/libexec/boost/1.76/include -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++17 -arch ppc -mmacosx-version-min=10.6 -MD -MT CMakeFiles/tilemaker.dir/src/output_object.cpp.o -MF CMakeFiles/tilemaker.dir/src/output_object.cpp.o.d -o CMakeFiles/tilemaker.dir/src/output_object.cpp.o -c /opt/local/var/macports/build/tilemaker-c46fb254/work/tilemaker-3.1.0/src/output_object.cpp
In file included from /opt/local/var/macports/build/tilemaker-c46fb254/work/tilemaker-3.1.0/src/output_object.cpp:5:
/opt/local/var/macports/build/tilemaker-c46fb254/work/tilemaker-3.1.0/include/output_object.h:30:17: error: 'uint' has not been declared
   30 |                 uint mz
      |                 ^~~~
make[2]: *** [CMakeFiles/tilemaker.dir/src/output_object.cpp.o] Error 1

Although I admit that Mac OS X 10.6 is old, I suspect this can be made to work.

I checked both Mac OS X 10.6 and macOS 12, and uint is defined in the <sys/types.h> header:

#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#include <sys/_types/_u_char.h>
#include <sys/_types/_u_short.h>
#include <sys/_types/_u_int.h>
#ifndef _U_LONG
typedef unsigned long           u_long;
#define _U_LONG
#endif
typedef unsigned short          ushort;         /* Sys V compatibility */
typedef unsigned int            uint;           /* Sys V compatibility */
#endif

and I don't see <sys/types.h> included in include/output_object.h nor in the other files where you reference uint. I'll ask the user to try adding that.

I couldn't find anyone saying that uint is a standard type or which header it should be defined in, so maybe this varies by OS vendor.

In another project, I see they fixed this same problem by including <sys/types.h> only on Apple systems: tgruben/go-ncs@d1e2311

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