- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have problems compiling our software using ifort under Mac OS. The error I get happens during the building of the binary. I have included a sample program that gives the identical error as I get with our software and ifort. The sample program compiles without error using g95 (0.91). The error I get is:
ifort -c testmod2.f90 -o testmod2.o
ifort -c testmod.f90 -o testmod.o
ifort -c test.f90 -o test.o
ar -r testlib.a test.o testmod.o testmod2.o
ar: creating archive testlib.a
ifort -o test.bin test.o testlib.a
ld: Undefined symbols:
_testmod2_mp_var1_module2_
make: *** [test.bin] Error 1
As can be seen from the program included below ifort has no problems with the module variables from testmod but has problems with the testmod2 variables.
The main program and modules:
PROGRAM test
USE testmod
USE testmod2
IMPLICIT NONE
integer :: a,b,c,d
write (*,*) 'Hello World'
a = 1
b = 4
c = 7
write (*,*) a,c,d
testmod_var = 10
var1_module2 = testmod_var
d = test_func(a,c)
write (*,*) testmod_var,d
write (*,*) var1_module2
END PROGRAM test
MODULE testmod
IMPLICIT NONE
PRIVATE
PUBLIC testmod_var,test_func
INTEGER,SAVE :: testmod_var
CONTAINS
FUNCTION test_func(a,b)
INTEGER :: test_func
INTEGER, INTENT(IN) :: a,b
test_func = a + b + 3
END FUNCTION test_func
END MODULE testmod
MODULE testmod2
IMPLICIT NONE
PRIVATE var2_module2
PUBLIC var1_module2
INTEGER :: var1_module2,var2_module2
END MODULE testmod2
I have problems compiling our software using ifort under Mac OS. The error I get happens during the building of the binary. I have included a sample program that gives the identical error as I get with our software and ifort. The sample program compiles without error using g95 (0.91). The error I get is:
ifort -c testmod2.f90 -o testmod2.o
ifort -c testmod.f90 -o testmod.o
ifort -c test.f90 -o test.o
ar -r testlib.a test.o testmod.o testmod2.o
ar: creating archive testlib.a
ifort -o test.bin test.o testlib.a
ld: Undefined symbols:
_testmod2_mp_var1_module2_
make: *** [test.bin] Error 1
As can be seen from the program included below ifort has no problems with the module variables from testmod but has problems with the testmod2 variables.
The main program and modules:
PROGRAM test
USE testmod
USE testmod2
IMPLICIT NONE
integer :: a,b,c,d
write (*,*) 'Hello World'
a = 1
b = 4
c = 7
write (*,*) a,c,d
testmod_var = 10
var1_module2 = testmod_var
d = test_func(a,c)
write (*,*) testmod_var,d
write (*,*) var1_module2
END PROGRAM test
MODULE testmod
IMPLICIT NONE
PRIVATE
PUBLIC testmod_var,test_func
INTEGER,SAVE :: testmod_var
CONTAINS
FUNCTION test_func(a,b)
INTEGER :: test_func
INTEGER, INTENT(IN) :: a,b
test_func = a + b + 3
END FUNCTION test_func
END MODULE testmod
MODULE testmod2
IMPLICIT NONE
PRIVATE var2_module2
PUBLIC var1_module2
INTEGER :: var1_module2,var2_module2
END MODULE testmod2
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After your 'ar' command, you need to run ranlib -c against it:
ranlib -c testlib.a
ron
ranlib -c testlib.a
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Ron!
that did it :-)
Cheers,
Michiel.

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