我使用f2c将一个巨大的Fortran子例程转换成C语言。标题显示如下:
/* fourier.f -- translated by f2c (version 20090411).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/我使用的是ubuntu 10.04。如何将目标文件与libf2c链接?
发布于 2010-07-14 03:37:18
您必须安装libf2c2-dev包--但是由于f2c包已经依赖于它,您可能需要做的就是将-lf2c添加到您的Makefile中。
发布于 2010-07-14 03:40:43
你是不是在和gcc一起编译生成的C文件?然后在gcc编译命令中添加"-lf2c -lm“。
为什么不使用Fortran编译器进行编译,比如gfortran?它很容易在Ubuntu上使用。
发布于 2010-07-14 03:38:23
通过将-lf2c -lm传递给将从对象创建可执行文件的行。你在Ubuntu上用的是哪种编译器?是GCC吗?
gcc -c fourier.c -lf2c -lm可能就这么简单。
https://stackoverflow.com/questions/3240761
复制相似问题