gpt4 book ai didi

c - Windows 上出现段错误,但 Linux 上没有(包括 GDB 信息)- C

转载 作者:行者123 更新时间:2023-11-30 17:00:41 24 4
gpt4 key购买 nike

我在 Windows 中遇到了段错误,但在 Linux 中却没有(同一程序)。使用GDB(minGW),我得到以下信息:

程序收到信号 SIGSEGV,段错误。 21 0x7c8024f0 中ReleaseMutex () 来自 C:\WINDOWS\system32\kernel32.dll

该程序在 Linux 系统上运行完成。崩溃发生在该函数的递归调用期间:

    void recursive_paint_char(int x,int y,int **inimage,int new_color,int fore_color)
{

/*
This routine paints the connected object around the pixel x,y in image inimage
to the color new_color. The foreground color is assumed to be fore_color.
*/
int i;
int xt,yt;

inimage[x][y]=new_color;
for (i=0;i<8;i++)
{

xt=x+xc[i];
yt=y+yc[i];
if (inimage[xt][yt]==fore_color)
{
printf("this statement prints\n");
recursive_paint_char(xt,yt,inimage,new_color,fore_color);
printf("this statement never prints\n");
}
}
}

在出现段错误之前,递归进行了大约 171,000 次调用

最佳答案

user3386109 回答了问题 - 问题似乎是堆栈大小。

关于c - Windows 上出现段错误,但 Linux 上没有(包括 GDB 信息)- C,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37450486/

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