我从Don下载了一个CWEB程序--特别是http://www-cs-faculty.stanford.edu/~knuth/programs/sliding.w。我把sliding.w转换成了sliding.c。现在,我试图使用以下方法编译它:
gcc滑行c -o滑动
但我得到了:
./sliding.w:116:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
main(int argc, char *argv[])
^
/tmp/cc9NVnXq.o: In function `main':
sliding.c:(.text+0x2006): undefined reference to `gb_init_rand'
sliding.c:(.text+0x201c): undefined reference to `gb_fptr'
sliding.c:(.text+0x202b): undefined reference to `gb_fptr'
sliding.c:(.text+0x2036): undefined reference to `gb_fptr'
sliding.c:(.text+0x2047): undefined reference to `gb_flip_cycle'
collect2: error: ld returned 1 exit status有谁可以帮我?
发布于 2017-11-25 23:58:45
第一个问题只是一个警告。致命的错误是您缺少了gb_符号,这些符号在这里定义:
flip.w
因此,首先需要将gb_flip.w编译成.c文件,然后将两个.c文件一起编译,如下所示:
gcc sliding.c gb_flip.c -o slidinghttps://stackoverflow.com/questions/47491632
复制相似问题