Reputation: 1
Given a very simple fortran (95) function and a very simple c++ call to the program, I should be able to compile the program using:
g++ -c main1.cpp
gfortran -c test.f95
g++ main1.o test.o -o run
However, here I get the following error:
ld: warning: object file (test.o) was built for newer macOS version (11.5) than being linked (11.0)
Undefined symbols for architecture arm64:
"hello_()", referenced from:
_main in main1.o
"__gfortran_st_write", referenced from:
_hello_ in test.o
"__gfortran_st_write_done", referenced from:
_hello_ in test.o
"__gfortran_transfer_character_write", referenced from: hello in test.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here, adding a -v
tag before the -o
tag and after the -o
tag and the exe run did not solve the problem, as suggested by the error message.
Upvotes: 0
Views: 272