linux下fortran中编译代码时“undefined reference to `_gfortran_st_”错误

在linux系统下fortran与c/c++混合编译的时候出现下列的错误:

/mnt/hgfs/subrar/ts/src/extra/../SAVE_DATAQ.f:117: undefined reference to `_gfortran_st_write_done'
/mnt/hgfs/subrar/ts/src/extra/../SAVE_DATAQ.f:126: undefined reference to `_gfortran_st_close'
/mnt/hgfs/subrar/ts/src/extra/../SAVE_DATAQ.f:127: undefined reference to `_gfortran_st_close'
DicomUtil.o: In function `getFcrDicomInfo(_IO_FILE*, char*)':
/mnt/hgfs/subrar/ts/src/extra/../DicomUtil.c:420: undefined reference to `ShortCutTime(char*)'
DicomUtil.o: In function `getThvDicomInfo(_IO_FILE*, char*)':
/mnt/hgfs/subrar/ts/src/extra/../DicomUtil.c:651: undefined reference to `ShortCutTime(char*)'
chs_sub.o: In function `chs_sub_':
/mnt/hgfs/subrar/ts/src/extra/../chs_sub.f:207: undefined reference to `_gfortran_st_write'
/mnt/hgfs/subrar/ts/src/extra/../chs_sub.f:207: undefined reference to `_gfortran_transfer_character_write'
/mnt/hgfs/subrar/ts/src/extra/../chs_sub.f:207: undefined reference to `_gfortran_st_write_done'
kofitc2.o: In function `kofitc2_':

解决方法:

     在编译连接的时候加入 gfortran 库,比如:

     LINUXWSLIBS   = -L/usr/include/X11/lib -lxview -lolgx -lX11 -lm -lf2c -lgfortran

 

你可能感兴趣的:(linux)