我已经分享了给我的代码,这些代码可以在一个 linux 系统上编译,但不能在更新的系统上编译。错误是 uint32_t 没有命名类型。我意识到这通常是通过包含 <cstdint>
来解决的或 stdint.h
.源代码没有这些,我正在尝试寻找一个不需要修改的选项,因为我无法控制内部业务实践。由于它在一台机器上按原样编译,他们不希望更改源代码。
我不确定这是否重要,但较旧的系统使用 gcc 4.1,而较新的系统使用 gcc 4.4。如果需要,我可以安装不同版本的 gcc,或者在较新的机器上添加/安装库/包含文件,我可以完全控制那台机器上的内容。
要在不修改源代码的情况下尝试在我的机器上编译此代码,我有哪些选择?如果需要,我可以提供其他详细信息。
最佳答案
I am not sure if it matters but the older system uses gcc 4.1 while the newer one uses gcc 4.4
GCC 停止包括 <stdint.h>
前一段时间。你现在必须包含一些东西才能得到它......
I realize that this is often fixed by including the
<cstdint>
orstdint.h
. The source code has neither of these includes and I am trying to seek an option that doesn't require modifying due to internal business practices that I can't control...
我希望我没有吹毛求疵...如果你不能修改源文件,那么你可以修改构建系统或配置文件吗?还是环境?如果是这样,您可以使用强制包含来插入文件。参见 Include header files using command line option?
可以修改Makefile
给力包括stdint.h
.如果构建系统支持 CFLAGS
或 CXXFLAGS
, 然后你可以强制将它包含在标志中。您最后的选择可能是执行类似 export CC="gcc -include stdint.h"
的操作.
我之所以分心是因为 OpenSSL 和 FIPS。 FIPS 对象模块的 OpenSSL 源文件被隔离,无法修改。我们必须回退到修改支持脚本和环境,以使某些事情按预期工作。
关于c++ - uint32_t 没有命名类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40663918/