I am using ifort and am getting a linking error when I attempt to compile my programs with compiler options. Nevertheless, I have tested out these options on a very small simple program I get the same issue.
I suspect therefore that it has to do with the way that ifort was installed or the type of system that I am using but I can't be sure. These programs compile alright when they are compiled with no options. My question is what am I doing wrong is there a way not to have these errors while using the compiler options or the compiler options simply not compatible with the system that I am using.
here is how the program is compiled regularly:
ifort -free testrealprint.out testrealprint.f90
here is how the program is compiled with options:
ifort -free -O2 -stand f03 -check all -traceback -warn all -fstack-protector - assume protect_parens -implicitnone testrealprint.out testrealprint.f90
here is the very simple code that I am using to test the compiler options:
program main
implicit none
real, dimension(1:3) :: adremvect
integer :: j
character (LEN = 7) :: adremchar, adremcharadj,adremcharadjtrm, adremcharnew
adremvect = (/ 2.0, 1.3, 1.0 /)
do j = 1, 3
write(adremchar, '(f5.1)') adremvect(j)
adremcharadj = adjustl(adremchar)
adremcharadjtrm = trim(adremcharadj)
adremcharnew = adremchar(4:)
print *, adremvect(j), adremcharadj, adremcharadjtrm, adremcharnew
end do
here is part of the error message that i receive when I use the compiler options:
testrealprint.out: In function `_start':
(.text+0x0): multiple definition of `_start'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib64/crt1.o:(.text+0x0): first defined here
testrealprint.out: In function `_fini':
(.fini+0x0): multiple definition of `_fini'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib64/crti.o:(.fini+0x0): first defined here
testrealprint.out:(.rodata+0x0): multiple definition of `_IO_stdin_used'
/usr/lib/gcc/x86_64-linux-gnu/4.4.3/../../../../lib64/crt1.o: (.rodata.cst4+0x0): first defined here
testrealprint.out: In function `__data_start':
(.data+0x0): multiple definition of `__data_start'
ld: error in testrealprint.out(.eh_frame); no .eh_frame_hdr table will be created.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…