linux - 使用 gfortran/gcc : crt1. o 编译时出错:在函数 `_start' 中

标签 linux linker libraries porting gfortran

我正在执行这个makefile使用 gfortran、gcc、netcdf 和 mpich2 库编译 Fortran 代码。

当make脚本执行以下命令时,

gfortran   -O3  -I/home/santiago/Install/mpich2_sam/include -I/home/santiago/Install/netcdf_sam/include /home/santiago/Modeling/SAM6.8.2/SRC/fft.f

我收到以下消息:

/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/crt1.o: In function _start': (.text+0x20): undefined reference tomain' collect2: error: ld returned 1 exit status

我在论坛中发现了类似的错误消息,但我没有看到如何在我的问题中应用这些解决方案。

有人可以指导我解决这个问题吗?

最佳答案

如果您正在构建库,则可能需要 -c 标志

.f.o:
    ${FF77}  ${FFLAGS} $<

.f.o:
    ${FF77}  ${FFLAGS} -c $<

同样适用

.f90.o:
    ${FF90} ${FFLAGS} -c $<
.c.o:
    ${CC} ${CFLAGS} -I$(SAM_SRC)/TIMING $(NOTIMERS) -c $<

关于linux - 使用 gfortran/gcc : crt1. o 编译时出错:在函数 `_start' 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34992899/

相关文章:

c - 具有 "Independent"目标文件的多个定义

python - JupyterLab 中 Plotly 的 Right 扩展名是什么?

c++ - 将一个对象的函数设置为由arduino库中的另一个对象调用

linux - 如何对 linux bash * 字母数字字符串进行排序

linux - PgAdmin 在数据库连接上陷入困境?

linux - 多线程应用程序的核心转储仅显示一个线程

java - 我如何知道 Java 导入的路径?

php - 跟踪用户的带宽

c++ - 使用 MSVC2010 在动态 QT 中使用 RegOpenKey 和 RegEnumKey

c++ - 如何在 C 中实现在 C++ 命名空间中声明的函数?