- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[plain]!===== file: testa_mod.f90 =====!
module testa
contains
function testa_func
integer :: testa_func
contains
subroutine internal_sub
testa_func = 2
end subroutine
end function
end module
!===== file: testb_mod.f90 =====!
module testb
contains
function testb_func
integer :: testb_func
contains
subroutine internal_sub
testb_func = 2
end subroutine
end function
end module
!===== file: testc_mod.f90 =====!
module testc
contains
function testc_func
integer :: testc_func
contains
subroutine internal_sub
testc_func = 2
end subroutine
end function
end module
!===== file: main.f90 =====!
program main
use testa
use testb
use testc
end program
[/plain]
I'm getting a linker error for multiple definitions (LNK1169), and I'm not sure if it's my fault or the compiler/linker. I haven't been able to pare my code down to a reproducible example, but the sample above shows the gist of what I'm doing. I have multiple modules in separate files. Each module has a function that happens to have an internal procedure of the same name. It's my understanding that internal procedures only have local scope, so I don't think this should be a problem. The linker disagrees:
error LNK2005: INTERNAL_SUB$BLK..T403_ already defined in testa_mod.obj file:testb_mod.obj
fatal error LNK1169: one or more multiply defined symbols found file: main.exe
If I remove 'testa' from the compilation there is no error, even though 'testb' and 'testc' also have internal procedures with the same name. The fix for this problem is trivial, so I'm just wondering if I'm in the wrong.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which exact compiler version are you using? This sounds like a problem we fixed some time ago. I can't reproduce it in 11.1.054.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Which exact compiler version are you using? This sounds like a problem we fixed some time ago. I can't reproduce it in 11.1.054.
This is with 11.1.054. The code I posted does not reproduce the problem. I haven't been able to pare down my actual code to a simple test case, and I wasn't entirely sure what I was doing was allowed in the first place. Now that I kow it might be a bug I'll try to reproduce it.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page