[英]Can't find symbols in stdint.h
When I used Apportable for my C++ source code, It cannot find symbols defined in stdint.h
. 当我将Apportable用作C ++源代码时,它找不到
stdint.h
定义的符号。
error: use of undeclared identifier 'UINT8_MAX'
The code worked well with Xcode, and this error raised only on Apportable. 该代码与Xcode一起使用时效果很好,并且此错误仅在Apportable上引发。 I added
#include <cstdint>
, but it was no effect. 我添加了
#include <cstdint>
,但是没有效果。
Here's my current .cpp
file. 这是我当前的
.cpp
文件。
#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). 定义__STDC_LIMIT_MACROS时,这些宏可用(此外,似乎也缺少__STDC_CONSTANT_MACROS)。 This is probably incorrectly gated or missing when compiling c++.
编译c ++时,这可能是错误地门控或丢失的。 Objective-C and C pick up on these defines for UINT8_MAX and accompanying macros.
Objective-C和C在UINT8_MAX及其随附的宏的这些定义中进行了介绍。 For now you can define both of those macros globally and it should have no ill effects on your project.
现在,您可以全局定义这两个宏,并且这不会对您的项目造成不良影响。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.