gpt4 book ai didi

c - 错误 : expected identifier or ‘(’ before ‘__extension__’

转载 作者:行者123 更新时间:2023-12-02 10:41:41 25 4
gpt4 key购买 nike

尝试编译我的代码库中的一个文件时,我收到一条奇怪的编译时错误消息。

使这个错误更加奇怪的是,它只发生在我在 Release模式下构建时 - 它在 Debug模式下编译没有问题。

以下是违规文件的(全部)内容:

#include <string.h>

char * strtok_r(char *s, const char *delim, char **save_ptr)
{
char *token;

if (s == NULL)
s = *save_ptr;

s += strspn (s, delim);
if (*s == '\0')
return NULL;

token = s;
s = strpbrk (token, delim);
if (s == NULL)
*save_ptr = strchr (token, '\0');
else
{
*s = '\0';
*save_ptr = s + 1;
}
return token;
}

我正在 Ubuntu 10.0.4 上使用 gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3 进行编译

有谁知道为什么我会收到这个错误?

最佳答案

您不能使用名称 strtok_r为您的函数名称,因为它已经在 string.h 库中。如果你使用 strtok_rrr 编译正常或者其他的东西。

关于c - 错误 : expected identifier or ‘(’ before ‘__extension__’ ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8020642/

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