gfortran

Automatic width integer descriptor in fortran 90

◇◆丶佛笑我妖孽 提交于 2019-12-05 18:09:08
I wanted to use automatic integer width descriptor in fortran 90. I referred to Output formatting: too much whitespace in gfortran This question says that I can use I0 and F0,0 for "auto" width. Here is my sample code (complied with GNU Fortran Compiler): PROGRAM MAIN IMPLICIT NONE INTEGER :: i REAL :: j WRITE (*,*) 'Enter integer' READ (*,100) i 100 FORMAT (I0) WRITE (*,*) 'Enter real' READ (*,110) j 110 FORMAT (F0.0) WRITE (*,100) 'Integer = ',i WRITE (*,110) 'Real = ',j END PROGRAM There is runtime error (unit = 5, file = 'stdin') Fortran runtime error: Positive width required in format Am

Unable to link to libgfortran.a [duplicate]

我们两清 提交于 2019-12-05 18:02:29
This question already has answers here : Why does the order in which libraries are linked sometimes cause errors in GCC? (9 answers) Closed 5 years ago . I have gfortran installed on my system and the file libgfortran.a can be found at /usr/lib/gcc/x86_64-linux-gnu/4.6/ . Using nm I made sure that the function _gfortran_compare_string is defined in there: $ nm /usr/lib/gcc/x86_64-linux-gnu/4.6/libgfortran.a | grep _gfortran_compare_string Returns 0000000000000000 T _gfortran_compare_string 0000000000000000 T _gfortran_compare_string_char4 But, the linker of my CUDA-C program throws errors:

How to provide an explicit interface to a library of Fortran 95+ modules, with implementation hiding

十年热恋 提交于 2019-12-05 15:46:33
I'm using gfortran's 95+ extensions. I have a library of utility modules I'd like to link to other projects, i.e. as a library or shared object / dll. However, in Fortran, I don't understand how to split the interface from the implementation in Fortran without maintaining two copies of the module interface. In C, I would separate the interface from the implementation like: api.h ←includes← impl.h ↑ ↑ includes includes ↑ ↑ user.c impl.c Is there a way to achieve the same effects in modern Fortran? Do I need to provide users my library with the .mod files? Single definition of an explicit

Stringify macro with GNU gfortran

こ雲淡風輕ζ 提交于 2019-12-05 15:25:01
How can I stringify a preprocessor macro with GNU gfortran? I would like to pass a macro definition to GNU gfortran which will then be used as a string in the code. Effectively I would like to do this: program test implicit none character (len=:), allocatable :: astring astring = MYMACRO write (*, *) astring end program test and then build with: gfortran -DMYMACRO=hello test.F90 I tried creating various macro, for example: #define STRINGIFY_(x) #x #define STRINGIFY(x) STRINGIFY_(x) ... astring = STRINGIFY(MYMACRO) but this doesn't work with the gfortran preprocessor. I also tried using a

Type bound procedure overloading in Fortran 2003

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 13:02:28
I've been programming in Java for a few years; however, I'm now taking a course which uses Fortran as example code (77 standard). Although I've always viewed Fortran as an ancient language, I decided to try out the latest implementation of the 2003 standard using the gfortran compiler to see its merits for myself. So far, I've been surprised with the modern features, but I have run into one issue which is demonstrated by the example below. module mod1 type type1 real :: x real :: y contains procedure :: compute end type type1 contains subroutine compute(this) class(type1) :: this this%y = this

library not found for -lbundle1.o when installing python packages (ffnet, spacepy) on my mac

陌路散爱 提交于 2019-12-05 12:44:23
I have the anaconda python distribution installed on my mac (10.9). I'm trying to install the ffnet package and the SpacePy package, but having trouble in doing so. Here is the error I get when doing sudo easy_install ffnet : ld: library not found for -lbundle1.o collect2: erreur: ld a retourné 1 code d'état d'exécution ld: library not found for -lbundle1.o collect2: erreur: ld a retourné 1 code d'état d'exécution error: Setup script exited with error: Command "/usr/local/bin/gfortran -Wall -m64 -Wall -undefined dynamic_lookup -bundle build/temp.macosx-10.5-x86_64-2.7/build/src.macosx-10.5-x86

Mixed language statically linking with gfortran and gcc

倾然丶 夕夏残阳落幕 提交于 2019-12-05 06:45:41
问题 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

How to install libgfortran.so.4 on ubuntu 16.06

醉酒当歌 提交于 2019-12-05 05:44:43
An app I use just updated and it no longer runs on my system. When I try to run the application I get the error: error while loading shared libraries: libgfortran.so.4: cannot open shared object file: No such file or directory I looked on my system and only libgfortran.so.3 is available. Do you know what should I do to have the next version also? Which package should I install? (my system is ubuntu 16.04) Vladimir F This is an inverse problem to R v3.4.0-2 unable to find libgfortran.so.3 on Arch So you must install GCC 7 including the Fortran part, that includes libgfortran 4. There are

How to compile in gfortran in case Sensitive mode?

*爱你&永不变心* 提交于 2019-12-05 03:24:32
Is it possible to compile a fortran 90/95 code in gfortran with Case Sensitive ? I searched the manuals, but couldn't find any flag or option I can give to gfortran to make it case sensitive. I want to have variables in upper case and lower case to be different. So, is it possible? There is no such flag or option. Of course, gfortran being free software, you're welcome to download the source code and create your own version with that particular feature. In reality, I'd recommend to just follow the Fortran standard and forget the idea of case sensitivity when programming Fortran. 来源: https:/

Fortran 90 - “Segmentation fault - invalid memory reference” with scalable 3D array

那年仲夏 提交于 2019-12-05 02:25:41
I have compiled a fortran 90 program with gfortran which builds a scalable 3D array in a way I want. Upon running, I get the following error: Program received signal SIGSEGV: Segmentation fault - invalid memory reference. Backtrace for this error: #0 0x10542ee42 #1 0x10542f60e #2 0x7fff8d7895a9 #3 0x10542575e #4 0x105425975 #5 0x105425d0e Segmentation fault: 11 I believe this is a memory issue with the large 3D array, as it works if I decrease the dimensions, but is there anyway to get around this? Here is my code: PROGRAM phantomtest IMPLICIT NONE INTEGER, PARAMETER:: columns=34, rows=34,