- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm working in a Linux system ( Ubuntu 12.04 ), using ifort linking the main program main.f90 and library lib.a. If I use command
ifort main.f90 /home/tom/lib/lib.a
then everything is fine. But if I use
ifort -L/home/tom/lib main.f90 lib.a
then ifort gives an error
ifort: error #10236: File not found: 'lib.a'
Why the -L specification doesn't work? When I want to use the environment variable LIBRARY_PATH ? It still gives me that error, why that happen? Must I specify the full path every time I link the library?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Libraries on Linux are found using -L (and/or LIBRARY_PATH) along with the lower-case "l" (i.e. -l<name> ) option. When using -l you leave off the leading "lib" portion of the library name as the linker automatically prepends "lib" to the name when searching for it, so if your library is named libEXP.a, then you link using something like:
ifort -L/home/tom/lib -lEXP main.f90
You will need add some additional characters to your library name and not try using a library named lib.a.
Hope that make sense.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Libraries on Linux are found using -L (and/or LIBRARY_PATH) along with the lower-case "l" (i.e. -l<name> ) option. When using -l you leave off the leading "lib" portion of the library name as the linker automatically prepends "lib" to the name when searching for it, so if your library is named libEXP.a, then you link using something like:
ifort -L/home/tom/lib -lEXP main.f90
You will need add some additional characters to your library name and not try using a library named lib.a.
Hope that make sense.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Kevin Davis (Intel) wrote:
Libraries on Linux are found using -L (and/or LIBRARY_PATH) along with the lower-case "l" (i.e. -l<name> ) option. When using -l you leave off the leading "lib" portion of the library name as the linker automatically prepends "lib" to the name when searching for it, so if your library is named libEXP.a, then you link using something like:
ifort -L/home/tom/lib -lEXP main.f90
You will need add some additional characters to your library name and not try using a library named lib.a.
Hope that make sense.
Thank you very much! It works!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great. Glad that helped.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page