gpt4 book ai didi

c - Windows 7 中一些奇怪的 C 编译错误

转载 作者:行者123 更新时间:2023-11-30 16:57:34 28 4
gpt4 key购买 nike

当我用VS 2013(Windows版Redis)编译以下方法geohash_move_x时,它给了我很多如下错误,但是这个问题只发生在win7上,在win10中没有错误。

error 188 error C2275: “uint64_t”: this expression is illegal

error 189 error C2146: grammar error: lack“;”

error 190 error C2065: “x”: un declared identitier

static void geohash_move_x(GeoHashBits *hash, int8_t d) {
if (d == 0)
return;

uint64_t x = hash->bits & 0xaaaaaaaaaaaaaaaaULL;
uint64_t y = hash->bits & 0x5555555555555555ULL;

uint64_t zz = 0x5555555555555555ULL >> (64 - hash->step * 2);

if (d > 0) {
x = x + (zz + 1);
} else {
x = x | zz;
x = x - (zz + 1);
}

x &= (0xaaaaaaaaaaaaaaaaULL >> (64 - hash->step * 2));
hash->bits = (x | y);

}

enter image description here

最佳答案

我建议您研究一下 geohash.c 文件的预处理器输出,并将其与 VS 2013 和 VS2015(或 Win 7 上的 VS2013 和 VS2013 Win 10)进行比较。也许它会给你一个答案,为什么编译器有 uint64_t 类型的问题。

要配置 VS 输出预处理文件,请转至 geohash -> geohash.c 文件并打开其属性页。将生成预处理文件属性修改为。在您的产品中,调试解决方案配置会构建发布配置,因此请小心更改正确项目配置中的选项。或者为所有人都这样做。

如果一切配置良好,您将在以下位置找到预处理的文件:

msvs\geohash\Win32\Release\geohash.i

在问题调查期间,您可能需要编译geohash.i。打开Developer Command Prompt for VScd进入msvs\geohash\Win32\Release目录并运行编译器:

cl /Tp geohash.i

关于c - Windows 7 中一些奇怪的 C 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39462993/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com