感谢提示!前进了一小步,运行时不报内存错误了,但问题还没彻底解决。
我的操作步骤:
1、卸载了内含gfortran的CodeBlocks v17.12,因为发现很难单独更新gfortran,也许是方法不当(替换同名文件,但会提示找不到若干dll文件,无法编译);
2、分别单独安装CodeBlocks v17.12(无编译器版) (codeblocks-17.12-setup.exe)、MinGW最新版(内含gfortran 8.2.0),添加环境变量,显示安装成功,如下:
C:\Users\86155>gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/8.2.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-8.2.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-8.2.0-5' --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-isl=/mingw --enable-libgomp --disable-libvtv --enable-nls --disable-build-format-warnings
Thread model: win32
gcc version 8.2.0 (MinGW.org GCC-8.2.0-5)
3、运行前述程序(open语句中写出了可给出文件操作结果是否成功的返回值IOSTAT),编译运行时发现不提示内存错误了,但返回值IOSTAT不等于0,即二进制文件还是没成功新建。
[Fortran] 纯文本查看 复制代码 implicit real*8 (a-h,o-z)
integer OUT
CVL= 2
ICH= 16
IRECSZ= 1
OPEN (UNIT = ICH,
. FILE = 'JPLEPH',
. ACCESS = 'DIRECT',
. FORM = 'UNFORMATTED',
. RECL = IRECSZ,
. STATUS = 'NEW',
. IOSTAT = iostat)
write(*,*) 'iostat=',iostat
WRITE(ICH,REC=1,IOSTAT=OUT) CVAL
write(*,*) 'OUT=',OUT
END
结果为:
iostat= 17
OUT= 5001
Process returned 0 (0x0) execution time : 3.222 s
Press any key to continue.
目前gfortran单独挂出来的还有9.X版本的,但下载下来试图去替换MinGW的bin中相应文件,发现会报找不到libisl-21.dll、libmpfr-6.dll,无法编译。
还请各位高手支支招。感谢! |