0

From a C main program I am calling a fortran subroutine which invokes various fortran features like opening and closing files.

I use gcc to link the C object with the fortran object and gcc lists the following as missing.

Undefined symbols for architecture x86_64:

  "__gfortran_st_close", referenced from:

  "__gfortran_st_open", referenced from:

  "__gfortran_st_read", referenced from:

  "__gfortran_st_read_done", referenced from:

  "__gfortran_st_rewind", referenced from:

  "__gfortran_st_write", referenced from:

  "__gfortran_st_write_done", referenced from:

  "__gfortran_stop_string", referenced from:

  "__gfortran_transfer_array", referenced from:

  "__gfortran_transfer_character_write", referenced from:

  "__gfortran_transfer_real", referenced from:

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ian Bush
  • 6,996
  • 1
  • 21
  • 27
  • 1
    Hello and welcome to StackOverflow. please take a moment and read this article https://stackoverflow.com/help/how-to-ask about how to asking questions also read this article https://stackoverflow.com/help/minimal-reproducible-example about how to ask a good question with minimum requirement. – nima Aug 26 '21 at 05:58
  • Hi, please write a summarized title and put the rest of the explanation in the body. Goodluck – nima Aug 26 '21 at 05:59
  • please share with us your workout, code snippets, error logs, or any useful information to help answer your question. – nima Aug 26 '21 at 05:59
  • please format your code with code fences to make the code readable – nima Aug 26 '21 at 05:59
  • 1
    Just link libgfortran, we have duplicates. Or link with gfortran. – Vladimir F Героям слава Aug 26 '21 at 07:01
  • Thank-you Vladimir. I successfully linked using gfortran. I am also looking for libgfortran.a on my machine so I can use the gcc linker. – Grateful_for_stackoverflow Aug 26 '21 at 07:18
  • 1
    Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it in Fortran?](https://stackoverflow.com/questions/66855252/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – veryreverie Aug 26 '21 at 07:37
  • 1
    In the final link step use `gfortran` instead of `gcc.` – steve Aug 26 '21 at 07:42

0 Answers0