gpt4 book ai didi

c++ - 具有 `stdio.h` 函数的模板和名称查找

转载 作者:太空宇宙 更新时间:2023-11-04 11:55:59 24 4
gpt4 key购买 nike

我正在尝试构建 PCL 32 位 Windows 7 中的库 MinGW .构建 outofcore 时模块我收到了关于 _fseeki64 的几条错误消息:

error: there are no arguments to '_fseeki64' that depend on a template parameter, so a declaration of '_fseeki64' must be available

octree_disk_container.h文件中有一个

#ifndef WIN32
#define _fseeki64 fseeko
#endif

我已经测试(生成一个 #error )和 WIN32在处理文件时定义。 _fseeki64编译器似乎可以使用这个小测试程序编译:

#include "stdio.h"
int main(int argc, char** argv) {
FILE* f = fopen("C:/a.txt","r");
if(!f) printf("NOPE");
int seekret = _fseeki64(f,4,SEEK_SET);
(void)seekret;
return 0;
}

如果我定义 _fseeki64作为fseeko64错误消失,模块编译,但我不确定行为是否与 fseeko 相同正如预期的那样 fseeki .

那么,我该怎么做才能使用 _fseeki64在这种情况下?也许声明一个新的基类,把 #define在那里然后称它为Base<T>::_fseeki64 ? (从 here 得到的想法)

你有什么想法?

最佳答案

所以问题似乎是您的 MinGW 系统执行 #define WIN32,但 _fseeki64 是微软主义,而不是 MinGW 知道的 POSIX 东西。我认为您应该在 MinGW 上使用 POSIX 行为,这意味着使用 fseeko

关于c++ - 具有 `stdio.h` 函数的模板和名称查找,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16147083/

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