I am having trouble compiling the following code:
extern const int foo = -1;
use, intrinsic :: iso_c_binding, only: c_int
public :: &
integer(kind=c_int), bind(c), protected :: FOO
end module cnst_m
use cnst_m, only: FOO
print *, FOO
end program cnst_p
When using the "-init=(minus_)huge" flag, the compiler returns:
/tmp/ifortSUJ720.o:(.data+0x0): multiple definition of `foo'
./cnst.o:(.rodata+0x0): first defined here
The problem is also present with real initialization.
I would wager this has something to do with the way default initialization is defined.
Thank you very much.
What happens if you do not define it in your C code:
extern const int foo;
but do so in Fortran:
integer(c_int), bind(C, name="foo"), protected :: FOO = 1
If this doesn't work, see if you can get help from Intel support.