- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am getting this error:
modD.obj : error LNK2005: vfe$0001INNER_SUB$BLK already defined in modC.objmodD.obj : error LNK2005: vfe$0000INNER_SUB$BLK already defined in modC.objDebug/module_namespace_conflict.exe : fatal error LNK1169: one or more multiply defined symbols found
This is because i have identically named inner code blocks in two modules:
[fortran]module m_C contains subroutine the_sub() integer(4)::int_a,int_b call inner_sub() contains subroutine inner_sub() write(*,'(I haven't looked it up in the standard but shouldn't this be allowed?i)') int_b end subroutine end subroutine end module module m_D contains subroutine the_sub() integer(4)::int_a,int_b call inner_sub() contains subroutine inner_sub() write(*,'( i)') int_b end subroutine end subroutine end module program main end program [/fortran]
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please report the contents of the files used in the compilation faithfully. If the code that you showed is put into one file and compiled, no error occurs. The linker output that you listed indicates that two object files were given to the linker. What do you have in files modC.f90 and modD.f90?
I do note that with Ifort 11.1 the VFE produces global symbols in the .OBJ file, but with 12.1 the VFE produces local symbols. Thus, if the same VFE were to be seen in two or more source files, multiple definitions would occur with version 11.1 but not with 12.1.
I do note that with Ifort 11.1 the VFE produces global symbols in the .OBJ file, but with 12.1 the VFE produces local symbols. Thus, if the same VFE were to be seen in two or more source files, multiple definitions would occur with version 11.1 but not with 12.1.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Indeed, module m_C is in modC.f90 and module m_D is in modD.f90. The program block is in a separate source file.
My compiler version is 12.0.1.127, and my license may not entitle me to any more updates. If so I'll just work around the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. VFEs are an extension, so you won't find anything in the standard on this.
2. Yes, it should work. It does work in 12.1 (Composer XE 2011 Update 6)
2. Yes, it should work. It does work in 12.1 (Composer XE 2011 Update 6)

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