- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your command lines are fine. Simply remove the nine .o files, recompile and relink. The problem should go away.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page