- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
compiling the listed code I get an error I do not understand. Perhaps someone knows why? I am using the Visual Fortran Compiler 12.0.3470.2010 in Visual Studio 2010 Professional.
There are two projects in my solution. The first project is called "Test", while the second one's called "Test2"
"Test" contains Test.f90:
program Test
use testzweimodule
implicit none
real :: a = 34
type(abc) :: thisabc
CALL thisabc%set_a(a)
write(*,*) 'Test.f90'
read(*,*)
end program Test
"Test2" contains Test2.f90:
program Test2
use testzweimodule
implicit none
real :: a = 34
type(abc) :: thisabc
CALL thisabc%set_a(a)
end program Test2
and Test2Module.f90:
MODULE testzweimodule
implicit none
type, public :: abc
real :: a
contains
procedure set_a=>set_a_sub
end type
private :: set_a_sub
contains
subroutine set_a_sub(this, a)
implicit none
class(abc) :: this
real :: a
this%a = a
write(*,*) a
read(*,*)
end subroutine set_a_sub
END MODULE testzweimodule
Okay, thank your for reading so far. Now the problem, when I try to build project "Test" I get the following error: error LNK2001: unresolved external symbol_TESTZWEIMODULE_mp_SET_A_SUB.
Project "Test2" runs without producing an error. Always. When in Test.f90 CALL thisabc%set_a(a)
is commented out (like: !CALL thisabc%set_a(a)), this project also is build without an error and runs fine.
In Project Dependencies of course, "Test" depends on "Test2".
I am not so deep in OOP, but isn't it possible to use objects from other projects? Using subroutines and functions from other modules in other projects never produces an error.
Would be nice, if someone can help me...I am sitting here for a few hours....
Greetings
Moritz
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What I suggest is putting TESTZWEIMODULE into its own static library project and making Test1 and Test2 dependent on it.

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