When I used Apportable for my C++ source code, It cannot find symbols defined in stdint.h
.
error: use of undeclared identifier 'UINT8_MAX'
The code worked well with Xcode, and this error raised only on Apportable. I added #include <cstdint>
, but it was no effect.
Here's my current .cpp
file.
#include <cstdint>
#include "Pixel.h"
namespace
Eonil
{
namespace
Graphics
{
using namespace std;
Pixel::Pixel(glm::vec4 const vector)
{
r = vector.r * ((Scalar)UINT8_MAX);
g = vector.g * ((Scalar)UINT8_MAX);
b = vector.b * ((Scalar)UINT8_MAX);
a = vector.a * ((Scalar)UINT8_MAX);
}
glm::vec4 const
Pixel::vector() const
{
return glm::vec4(((Scalar)r) / ((Scalar)UINT8_MAX),
((Scalar)g) / ((Scalar)UINT8_MAX),
((Scalar)b) / ((Scalar)UINT8_MAX),
((Scalar)a) / ((Scalar)UINT8_MAX));
}
}
}
What am I missing?
The macros are available when __STDC_LIMIT_MACROS is defined (additionally __STDC_CONSTANT_MACROS seems to be missing as well). This is probably incorrectly gated or missing when compiling c++. Objective-C and C pick up on these defines for UINT8_MAX and accompanying macros. For now you can define both of those macros globally and it should have no ill effects on your project.