[英]Why is gcc not complaining about missing symbol?
I have defined the following in ac file: 我在ac文件中定义了以下内容:
#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 flags are: -Wall -Wno-long-long -fexpensive-optimizations -fomit-frame-pointer -funroll-loops -pipe -fexceptions -Wpointer-arith -Wcast-align -Wsign-compare -pedantic -mmmx -msse
gcc标志包括:
-Wall -Wno-long-long -fexpensive-optimizations -fomit-frame-pointer -funroll-loops -pipe -fexceptions -Wpointer-arith -Wcast-align -Wsign-compare -pedantic -mmmx -msse
After compiling (in a Ubuntu 14.04 machine) with gcc version 4.8.2 successfully the program exits at runtime with undefined symbol: _free
Obviously the symbol _free
is unknown, but why does gcc not complain about this? 在gcc版本4.8.2(在Ubuntu 14.04计算机中)成功编译后,程序在运行时以
undefined symbol: _free
退出undefined symbol: _free
显然_free
符号是未知的,但是gcc为什么不抱怨呢? I would expect it to throw an error at linking time like the VS linker does. 我希望它像VS链接器一样在链接时抛出错误。
free
在Linux和C Standard上都没有领先的下划线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.