簡體   English   中英

為什么gcc不抱怨缺少符號?

[英]Why is gcc not complaining about missing symbol?

我在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標志包括: -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退出undefined symbol: _free顯然_free符號是未知的,但是gcc為什么不抱怨呢? 我希望它像VS鏈接器一樣在鏈接時拋出錯誤。

free在Linux和C Standard上都沒有領先的下划線。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM