- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a simple test for ifort.
test.90:
integer a,b,c
a = 1
b = 2
call sub(a,b,c)
write(*,*)'c=',c
stop
end
sub.f90:
subroutine sub(a,b,c)
integer a,b,c
c=a+b
return
end
The makefile is:
lib = sub.lib
exe = test.exe
$(lib):
ifort /c sub.f90
lib /out:$(lib) sub.obj
$(exe):
ifort test.f90 sub.lib
clean:
-del *.exe *.obj
I first make the library with the command
make sub.lib
Then I try to make the exe with the command
make test.exe
This gives an error on linking - LNK1104: Cannot open file ifconsol.lib.
However, if I give the command
ifort test.f90 sub.lib
at the command prompt, the program is made without error.
Why is the makefile causing this error?
Thank you.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Change all uses of "lib" in your makefile to some other spelling (e.g. mylib). As is, the name interferes with the LIB environment variable and throws off the linker. Another way to see the interference is to run nmake with the /E option; however, /E is not the solution though, renaming 'lib' is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your makefile obliterates the LIB environment variable that the linker uses for the library search path.
Rename the `lib` variable in your makefile to something else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ianh wrote:
Your makefile obliterates the LIB environment variable that the linker uses for the library search path.
Rename the `lib` variable in your makefile to something else.
Thank you Kevin and Ian. It is now working.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page