Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

Linker doesn't find static library although the libpath entry is correct

Dobrivoje_N_
Beginner
1,839 Views
Thanks for thereply. I tried the LIB env. variable mentioned by yourself too, but to no avail. On the other hand, I would hate to specify my libraries via any global (in the sense of VisualStudio) env. variable, as this prevents project-specific linking such as e.g. using different versions of the same library in different project versions. It worked finein CVF.
What is the intended function of LIBPATH anyway?
0 Kudos
7 Replies
Jugoslav_Dujic
Valued Contributor II
1,839 Views
Pozdrav Dobrivoje,

/libpath specifies only additional library directories. You still have to specify the name of the library on Linker/Input/Additional dependencies (/link option of ifort).

Alternatively, you can spell out full path to your library in /link; in this case, you don't need /libpath.

Hope this helps,
Jugoslav
0 Kudos
Steven_L_Intel1
Employee
1,839 Views
LIBPATH as an environment variable is meaningless to both the Intel and Compaq compilers. On the command line, there is a /LIBDIR switch which can be used to specify additional library directories.
0 Kudos
Dobrivoje_N_
Beginner
1,839 Views

Pozdrav (i hvala) Jugoslave,

It works like Jugoslav suggested it, in both variants (i.e. with /libpath and /link), and in both CVF and VS2003.

I specify libraries in CVF under the Object/Library Modules option, with an added benefit of the wildcard specification. The latter, however, doesn't work in VS.

Thanks for help!

0 Kudos
niels_veldhuijzen
1,839 Views

Dear all,

I am new to the Intel Fortran 9 compiler and to VS2003, so maybe I'm a bit clumsy, but... I still don't see how to find a static library when linking. What must I specify in VS2003, and where? If the only way is via the command line, where do I find access to this line?

Yours sincerely,

Niels H. Veldhuijzen

Cito, Arnhem, The Netherlands

0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,839 Views
Method 1): Project->Add Existing Item->Browse to your .lib file

Method 2a):
Project->Properties->Linker->General->Additional library directories->add "C:DirectoryOfYourLib"
Project->Properties->Linker->Input->Additional dependencies; append "Yourlib.lib"

Method 2b):
Project->Properties->Linker->Input->Additional dependencies; append "C:DirectoryOfYourLibYourlib.lib"

Method 2c):
Tools->Options->Intel Fortran->Libraries->add "C:DirectoryOfYourLib"
Project->Properties->Linker->Input->Additional dependencies; append "Yourlib.lib"

Method 1 is simplest (but I'm not positive if it works). Method 2a) is better than 2b) when you have more than one .lib file to work with. Method 2c) is suitable when you e.g. have a directory full of .libs which you reuse in several solutions; it adds
the directory permanently to the search path.

Tip: When specifying directories, it's always better to use paths relative to .vfproj file (e.g. ..LibProjectDebug) than absolute paths (C:WhereverProjectRootLibProjectDebug) where available. In this way, you can move the entire solution to another location/computer without recreating entire tree.

HTH,
Jugoslav
0 Kudos
niels_veldhuijzen
1,839 Views

Dear Jugoslav,

I tried your method 2b, and it works fine. Now I ran into other trouble (symbols in the library are unresolved), but I won't bother you with it.

I knew about "Properties->Linker->General->Additional library directories", but that wasn't enough. So thank you very much for your help!

Best wishes,

Niels H. Veldhuijzen

0 Kudos
Dobrivoje_N_
Beginner
1,839 Views

Hello Niels,

Method 1 as spelled out by Jugoslav works fine - this was my solution at the time of submitting this item to the forum. Method 2a is my current solution, with a couple of paths in libpath, and the libraries needed under Additional Dependencies.

Cheers,

Dobrivoje

0 Kudos
Reply