2011-11-26 118 views
1

我試圖從http://www.yendor.com/programming/sort/C庫編譯錯誤

直接鏈接編譯整理庫庫:http://www.yendor.com/programming/sort/sort-all.tgz

當我運行使編譯器說:

gcc -g -O -DCUTOFF=15 -c sorttest.c 
In file included from sorttest.c:15: 
sort.h:66: error: conflicting types for ‘heapsort’ 
/usr/include/stdlib.h:301: error: previous declaration of ‘heapsort’ was here 
make: *** [sorttest.o] Error 1 

燦有人幫助解決這個問題?

+0

看起來像兩個文件試圖定義'heapsort' – tekknolagi

回答

2

霧,

那麼,編譯器抱怨型heapsort在行301/usr/include/stdlib.h已經定義...對於解決這些問題的傳統方法是:

  • 使用其他名稱對於代碼中的違規文章。一個假設myheapsort應該做得很好。 (是的,你可以修改sort-all.tgz,怎麼把它基於GNU GPL發佈)使用#def的#ifndef(如果你不能改變你的代碼)的heapsort
  • 剿STDLIB的定義。
  • 尖叫,哭泣,詛咒,並希望所有stdlib(至少)在哪裏創建的平等。嘆。

希望有幫助。

+0

謝謝!,我用你的建議,只是改變了代碼myheapsort。 – Icestorm