简体   繁体   中英

linux gfortran gdb error During startup program exited with code 126

I have a Fortran program that I wrote, and ran, in 1996 that I am trying to import to gfortran 95.

After editing I compiled the source code:

gfortran -c -g -fno-align-commons MT3Dm2.f95 -o MT3Dm2

which generated no error messages.

I then ran gdb and got:

Success
During startup program exited with code 126.

Googling the error message resulted in nothing that I could understand.

Pointers on how to proceed will be much appreciated.

This command:

gfortran -c -g -fno-align-commons MT3Dm2.f95 -o MT3Dm2

produces a relocatable object file (because you told the compiler to only compile , but not link with the -c flag).

I suspect that you are trying to run the resulting MT3Dm2 as if it were an executable (which it is not ). You must actually link the executable:

gfortran -g -fno-align-commons MT3Dm2.f95 -o MT3Dm2

or, if you prefer to keep compile and link steps separate:

gfortran -c -g -fno-align-commons MT3Dm2.f95
gfortran -g MT3Dm2.o -o MT3Dm2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM