确定何时在预处理器中从64位交叉编译为32位

Determining when cross compiling for 32 bit from 64-bit in preprocessor?

本文关键字:64位 交叉编译 32位 处理器 何时 预处理      更新时间:2023-10-16

我使用了在c++中确定32位与64位的答案:

#ifndef AVUNA_CFG
#define AVUNA_CFG
#if _WIN32 || _WIN64
#if _WIN64
#define BIT64
#else
#define BIT32
#endif
#endif
// Check GCC
#if __GNUC__
#if __x86_64__ || __ppc64__
#define BIT64
#else
#define BIT32
#endif
#endif
#endif

然而,当将-m32指定给GCC进行交叉编译时,这似乎不起作用,所以它总是说BIT64。有什么定义可以用于此目的吗?

我最终使用eclipse定义,因为我有两种不同的32/64位交叉编译运行配置。好用。