Windows OpenCOBOL静态链接多个.cob文件

Windows OpenCOBOL静态链接多个.cob文件,windows,compiler-errors,compilation,cobol,gnucobol,Windows,Compiler Errors,Compilation,Cobol,Gnucobol,我正试图使用GnuCobol(windows10)将两个COBOL文件静态链接在一起,如下所示:但似乎无法让它工作 我正在运行以下程序: cobc -free -c InterpFunc.cob cobc -free -c -fmain Integrator.cob cobc -x -o .\\dist\\integrator Integrator.o InterpFunc.o “.o”文件编译正确,但二进制文件从未生成,并出现以下错误: H:\Programs\COBAL\cobc\bin

我正试图使用GnuCobol(windows10)将两个COBOL文件静态链接在一起,如下所示:但似乎无法让它工作

我正在运行以下程序:

cobc -free -c InterpFunc.cob
cobc -free -c -fmain Integrator.cob 
cobc -x -o .\\dist\\integrator Integrator.o InterpFunc.o
“.o”文件编译正确,但二进制文件从未生成,并出现以下错误:

H:\Programs\COBAL\cobc\bin\cobc.exe: unrecognized option '-fmain'
h:/programs/cobal/cobc/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain@16'
collect2.exe: error: ld returned 1 exit status
The terminal process terminated with exit code: 1
我尝试过一些不同的方法,比如省略'-fmain'或'-x',但似乎都会产生不同的错误


这可能是我的编译器/系统设置的问题,还是我误解了如何静态链接文件?

我很确定您没有使用与旧文档匹配的编译器(URL中有“历史记录”)。我很肯定它会像上面说的那样工作:

组合多个文件的最简单方法是将它们编译成单个可执行文件

一种方法是在一个命令中编译所有文件:

$ cobc -x -o prog main.cob subr1.cob subr2.cob
另一种方法是使用选项-c编译每个文件,并在最后链接它们。>顶级程序必须使用-x选项编译

$ cobc -c subr1.cob
$ cobc -c subr2.cob
$ cobc -c -x main.cob
$ cobc -x -o prog main.o subr1.o subr2.o