Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Trying to compile program with use module on command line

awa5114
Beginner
1,069 Views

I have 2 .f90 files.

file: mod_def.f90 

module definedmod
integer :: a = 4
end module definedmod

file: use_mod_def.f90

program usemod
use definedmod
	print *, a
end program usemod

I succeeded in compiling the module definition file using this command:

ifort -c mod_def.f90

THis generated a .obj and .mod file which is good. However when I try to compile the main program

ifort use_mod_def.f90

I get a big error

D:\TEMP\TRUNK-IFORT\test>ifort use_mod_def.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Inte
l(R) 64, Version 13.0.1.119 Build 20121008
Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:use_mod_def.exe
-subsystem:console
use_mod_def.obj
use_mod_def.obj : error LNK2019: unresolved external symbol DEFINEDMOD_mp_A refe
renced in function MAIN__
use_mod_def.exe : fatal error LNK1120: 1 unresolved externals

How do I compile the main program and have it recognize the use module?

As a side notes the online help docs don't  provide a working example. They only gloss over some generalities. It would be good to have working examples that users can copy, paste and work with...

Thanks and look forward to your responses.

 

0 Kudos
1 Reply
awa5114
Beginner
1,069 Views

Nevermind I got it from this thread https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/290070

what I did was:

>ifort -c mod_def.f90

>ifort use_mod_def.f90 mod_def.obj

Then I got the executable.

0 Kudos
Reply