gpt4 book ai didi

c - 为什么 gcc 不提示缺少符号?

转载 作者:行者123 更新时间:2023-11-30 17:19:02 26 4
gpt4 key购买 nike

我在 c 文件中定义了以下内容:

#ifdef __clang__
// clang definition here
#elif defined _GNULINUX
#define _ALIGNED_FREE(pMempointer) _free((pMempointer))
#elif defined _MSC_VER
// VS definition here
#else
// default definition
#endif

void * pMemory = 0L;
if(pMemory) {
_ALIGNED_FREE(pMemory);
}

gcc 标志是:-Wall -Wno-long-long -fexpense-optimizations -fomit-frame-pointer -funroll-loops -pipe -fexceptions -Wpointer-arith -Wcast-align -Wsign-compare -pedantic -mmmx -msse >

使用 gcc 版本 4.8.2 成功编译(在 Ubuntu 14.04 计算机中)后,程序在运行时退出,并显示 undefined symbol :_free显然符号_free是未知的,但是为什么gcc不提示这个呢?我希望它会像 VS 链接器那样在链接时抛出错误。

最佳答案

free 在 Linux 中和 C 标准中都没有前导下划线。

关于c - 为什么 gcc 不提示缺少符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28982414/

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