gfortran

gfortran error: unexpected element '\' in format string at (1)

﹥>﹥吖頭↗ 提交于 2019-12-04 04:45:12
问题 I have a project written in VS2010 with Intel Visual Fortran. I have a dump subroutine to write a 2D matrix into file: subroutine Dump2D(Name,Nx,Ny,Res) implicit none integer i,j,Nx,Ny real(8) :: Res(Nx,Ny) character(len=30) name,Filename logical alive write(filename,*) trim(Name),".dat" Write(*,*) "Saving ",trim(Name)," Please wait..." open (10,file=filename) do i=1,Ny Write(10,FMt="(D21.13\)") (Res(j,i),j=1,Nx) Write(10,*) end do close(10) Write(*,*) "Save ",trim(Name),"Complete!" return

ieee_arithmetic intrinsic module in gfortran

拥有回忆 提交于 2019-12-04 02:57:32
问题 I need to use gfortran to compile a library that is dependent on ieee_arithmetic . However, it is found that gfortran can not identify this module. For example with the code a.f90 program test use,intrinsic :: ieee_arithmetic real :: x read *, x if (ieee_is_nan(x)) then print *, "Nan" else print *, "Not NaN" end if end program test I have the following message when compiling $ gfortran a.f90 a.f90:2.19: use,intrinsic :: ieee_arithmetic 1 Fatal Error: Can't find an intrinsic module named 'ieee

The minimum and maximum floating point exponent of a real number

∥☆過路亽.° 提交于 2019-12-04 02:30:01
问题 How can I get the minimum and maximum exponent for 32- and 64-bit real numbers? I am doing some work to avoid underflows and overflows and would need to know those numbers. I would also need the base for floating point numbers. Is it possible in fortran to get the equivalent of ilmach ? 回答1: For non-zero reals, the numeric model looks like s*b^e*\sum_{k=1}^{p}f_k*b^{-k} . To get the value of the base b use radix() . The minimum and maximum values of the exponent e can be found with exponent

Mixed language statically linking with gfortran and gcc

六月ゝ 毕业季﹏ 提交于 2019-12-03 21:42:51
I have some code written in C and Fortran that I want to compile into a statically-linked executable. If I compile the code dynamically (using the -fno-underscoring option for gfortran), it all works fine. However, I want to link it into a .so file, statically linking most of the needed libraries, and then link dynamically to libkrb5 , very much like the method described in this blog post . I followed the steps in the previous blog post, and I managed to compile the .so library without any problems. nm shows that it is in good shape, with my Fortran subroutines and C functions showing up: [...

Fortran is reading beyond endfile record

只谈情不闲聊 提交于 2019-12-03 15:54:19
I'm trying to read some data from a file, and the endfile record detection is important to stop reading. However, depending of the array dimensions of the array used to read data, I cannot detect properly the endfile record and my Fortran program stops. The program is below: !integer, dimension(3) :: x ! line 1.1 !integer, dimension(3,10) :: x ! line 1.2 integer, dimension(10,3) :: ! line 1.3 integer :: status,i=1 character(len=100) :: error open( 30, file='data.dat', status='old' ) do print *,i !read( 30, *, iostat=status, iomsg=error ) x ! line 2.1 !read( 30, *, iostat=status, iomsg=error )

gfortran: compiling 32-bit executable in 64-bit system

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm running Ubuntu 12.10 (64-bit), with Linux kernel 3.5.0-51-generic, on an AMD Athlon(tm) 64 X2 Dual Core Processor 5200+ ×2. I have GNU Fortran (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2. I'm trying to compile some code into a 32-bit executable. I've checked that all the needed libraries are installed on my system (I ran ldd on a program previously compiled on a 32-bit computer, and downloaded the missing packages). I tried running $ gfortran foo.f -m32 -L/lib/i386-linux-gnu, but I get the following errors: /usr/bin/ld: cannot find crt1.o: No

Correct way to statically link in gfortran libraries on OSX

元气小坏坏 提交于 2019-12-03 01:02:44
I've a fortran program I'd like to distribute, so I'd like to statically link in the gfortran libraries. If I compile the program with the following flags: gfortran -o myprog -static-libgfortran -static-libgcc myprog.f otool tells me it's statically linked in most of the gofrtran libraries, but not libquadmath: otool -L myprog /usr/local/gfortran/lib/libquadmath.0.dylib (compatibility version 1.0.0, current v /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) There is a static libquadmath library /usr/local/gfortran/lib/libquadmath.a , but every link line I tried

lgfortran not found

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Ubuntu 10.04 and trying to compile some code that uses gfortran. At some point Makefiles does: -L. -lgfortran and I get the error /usr/bin/ld: cannot find -lgfortran although it is installed: ldconfig -p | grep fortran libgfortran.so.3 (libc6,x86-64) => /usr/lib/libgfortran.so.3 How can I fix it? P.S: The Makefile: ## FLAGS CC:= gcc C++:= g++ CFLAGS:= -c -O -Dintel -g FC:= gfortran FFLAGS:= -c -O -cpp -g LD:= g++ LDFLAGS:= -O WETTER_CGAL_FLAGS:= -g #WETTER-Data WETTER_cgal: weather.cpp surface_alg.h $(WETTER_CGAL_OBJECTS) WATT

安装gfortran

匿名 (未验证) 提交于 2019-12-03 00:19:01
本人是在Mac上进行安装,话不多说,直接上命令 brew install GCC 在brew上查询了gfortran,提示我现在gfortran是GCC的中一部分,直接安装GCC就是了 文章来源: 安装gfortran

安装gfortran

匿名 (未验证) 提交于 2019-12-03 00:18:01
本人是在Mac上进行安装,话不多说,直接上命令 brew install GCC 在brew上查询了gfortran,提示我现在gfortran是GCC的中一部分,直接安装GCC就是了 文章来源: 安装gfortran