Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
69 Views

command line compile error on the MAC console

  I try to build the Fortran code containing several fortran files with modules. I run it like this :

ifort -c constant.f90 CommonSub.f90 typedef.f90 globals.f90 output.f90 Prepro.f90 mesh3d.f90 ccfluids.f90 RMHD3D.f90 

ifort -o MHD constant.o CommonSub.o typedef.o globals.o output.o Prepro.o mesh3d.o ccfluids.o RMHD3D.o

It open the following error:

ld: can't link with a main executable file 'constant.o' for architecture x86_64

How can I fix this problem ??

 

PS:

The version of Intel Fortran compiler on Mac machine :

$ ifort -V

Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.0.117 Build 20180804

Copyright (C) 1985-2018 Intel Corporation.  All rights reserved.

 

 

0 Kudos
2 Replies
Highlighted
Black Belt Retired Employee
69 Views

A bit of Googling suggests that constant.o is already linked as an executable file. How sure are you that you used -c on the first line?

0 Kudos
Highlighted
Black Belt
69 Views

Your command lines are fine. Simply remove the nine .o files, recompile and relink. The problem should go away.

0 Kudos