在21世纪初,我使用这个代码库运行了一个mud,通过它,我自学了一些非常基础的编码。
我刚从在我之前运行服务器的管理员/程序员那里得到了代码库的副本,我几乎可以肯定它会按原样编译,但现在不会了。
我唯一的猜测是,这与最近15-20年来对GCC的更新有关,但无可否认,我是一个新手,在这里我不太了解。
这是当我尝试使用make编译它时,在大约一百页的警告之后得到的错误:
[18:24:54] finger.c ...
In file included from finger.c:10:0:
../src/include/merc.h:5149:13: warning: inline function ‘check_toughness’ declared but never defined
inline int check_toughness args( ( CD *ch, CD *victim, int dam));
^~~~~~~~~~~~~~~
[18:24:54] Linking Executable ...
obj/fight.o: In function `group_gain':
tbw/reloaded/src/fight.c:5514: undefined reference to `xp_compute'
tbw/reloaded/src/fight.c:5516: undefined reference to `xp_compute'
tbw/reloaded/src/fight.c:5518: undefined reference to `xp_compute'
obj/fight.o: In function `one_hit':
tbw/reloaded/src/fight.c:2457: undefined reference to `check_toughness'
obj/mage.o: In function `do_chant':
tbw/reloaded/src/mage.c:345: undefined reference to `check_toughness'
tbw/reloaded/src/mage.c:361: undefined reference to `check_toughness'
tbw/reloaded/src/mage.c:377: undefined reference to `check_toughness'
tbw/reloaded/src/mage.c:393: undefined reference to `check_toughness'
obj/mage.o:tbw/reloaded/src/mage.c:409: more undefined references to `check_toughness' follow
obj/update.o: In function `mobile_update':
tbw/reloaded/src/update.c:756: undefined reference to `werewolf_regen'
obj/powerl.o: In function `do_planarstorm':
tbw/reloaded/src/powerl.c:680: undefined reference to `check_toughness'
collect2: error: ld returned 1 exit status
Makefile:27: recipe for target '../src/reloaded' failed
make: *** [../src/reloaded] Error 1代码库和引用的文件很大,所以我认为现在附加它们还没有意义,但如果需要的话,我肯定可以提供它们。
根据记录,像"check_toughness“和"xp_compute”这样的函数是在几千个LOC之后在这些文件中明确定义的。
非常感谢您的建议,谢谢!
发布于 2020-01-07 04:28:59
感谢每一位提出建议的人!
rici提供了最简单的答案
,这可能是代码对内联使用了旧的特有的gcc语义的结果。尝试使用--std=gnu89进行编译(如果您使用的是gcc)。
将其添加到Makefile中可以清除所有错误,并导致成功编译。
https://stackoverflow.com/questions/59617763
复制相似问题