为什么gcc不抱怨丢失符号?

时间:2015-03-11 09:11:31

标签: c gcc macros compiler-errors

我在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 -fexpensive-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链接器一样在链接时抛出错误。

1 个答案:

答案 0 :(得分:0)

free在Linux和C标准中没有领先的下划线。

相关问题