Hes*_*aqi 5 c gcc c-preprocessor
通常 Microsoft 代码使用__int64GCC 不理解的代码。我知道我可以把它写成这样的宏:
#define __int64 long long
Run Code Online (Sandbox Code Playgroud)
但由于代码可移植性,我不想这样做。我正在尝试为 GCC 提供以下预处理器选项:
-D__int64="long long"
Run Code Online (Sandbox Code Playgroud)
由于两者之间的空格,我收到以下错误long:
gcc.exe: error: long: No such file or directory
Run Code Online (Sandbox Code Playgroud)
如何解决?
您可以使用int64_t, 该类型的标准名称,但它只有在代码可以使用时才有效#include <stdint.h>,而这可能是希望太多了。
否则,您可以尝试typedef在一些常见标题中“潜行” :
typedef long long __int64;
Run Code Online (Sandbox Code Playgroud)
也许只有在检测到 GCC 时才这样做。
修复它“你的方式”当然应该是可能的,它看起来像一些引用问题。