Steve
Steve

Reputation: 173

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.

Upvotes: 1

Views: 535

Answers (1)

Employed Russian
Employed Russian

Reputation: 213516

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

Upvotes: 1

Related Questions