How to build static library in Visual Studio 2005

I use PGF 7.0-4 in MS Visual Studio 2005.
I have a bunch of files from which I want to build a library. I start a new project, choose static library as project type. The build is successful and the library is created in C:\test\library\libaz.lib

Next I build another project that makes use of libaz.lib. No matter what I did, libaz.lib is not found by the linker. Here’s what I have tried:
-LC:\test\library\libaz.lib (upper case L)
-LC:\test\library\ (upper case L)
-lC:\test\library\libaz.lib (lower case l)

When I use lower case l the compiler complains: not found libC:\test\library\libaz.lib because it adds “lib” to my actual path for libaz.lib

If I use only -laz.lib, then the compiler complains not found libaz.lib

Please help me, where should I declare my library? how to prevent the compiler to prepend lib to the library?

Thanks

Giang Nong

Hi Giang,

To add libraries to a PVF project you need to open the “property page” for your project and edit the “Linker->General->AdditionalLibraryDirectories” setting to include the full path to your library. You do not need the “-L”. Next edit the “Linker->Input->AdditionalDependancies” property to include the name of your library.

If you need an example, open the “pvf_calling_vc” sample project that is included with your PVF installation.

Hope this helps,
Mat

Hi Mat,

Your approach seems to work with 1 library.

I have 3 libraries and they have different paths. In “Linker->General->AdditionalLibraryDirectories” I put all three paths here:

c:\path1; c:\path2; c:\path3

and then in “Linker->Input->AdditionalDependancies” I put all three names of library:

lib1.lib, lib2.lib, lib3.lib

I tried using both comma and space to separate library names, the error I got is:

'Cannot open input file ‘lib1.lib, lib2.lib, lib3.lib’
or
'Cannot open input file ‘lib1.lib lib2.lib lib3.lib’

Please help me to organize 3 libraries that have different paths

Thanks a lot

Giang

Hi Giang,

Put semicolons between the library names. “lib1.lib; lib2.lib; lib3.lib”.

  • Mat

Hi Mat,

The use of semi colon does not help, I still get this error:

Error 1 cannot open input file ‘Libaz.lib; IMSL.lib; CRUSH32.LIB; jvm.lib; skr90gen.lib; skr90l32.lib’ LINK

In Visual Studio 2005 when you open a project you will see “Solution Explorer” which has 3 sections on the right hand side: Include Files, Resource Files, Source Files. I place all my source code in Source Files but I can not use Resource Files to place my libraries and Include Files to place my .inc files.

For Intel and Compaq compiler, Include Files is for .inc files and Resource Files is used for libraries. For some reason this does not work for PVF. It would be much more convenient if I can use Resource Files to place all my libraries.

Giang

Sorry Giang, my mistake. The library names should be separated only with spaces.

  • Mat

Hi Mat,

I already tried putting space between library names (see my post on July 05 at 6:56am), it does not work. So far I have tried using comma, space, semi colon but none of them work.

Let me recap my problem again: I use PVF in Visual Studio 2005. My project needs to use a number of libraries that have diffeent paths. For example, I have 3 libraries:
c:\path1\lib1.lib, c:\path2\lib2.lib, c:\path3\lib3.lib

I put all the paths in Linker/general using ; as separator
I put all library names in Linker/Input using semi colon, comma, space as separator.

I am able to specify just ONE library, when I have more than one library I got the error like

can not open input file ‘lib1.lib lib2.lib lib3.lib’

Thanks

Giang

Hi Giang,

I’m forwarding your information to our PVF team. Hopefully one of them can help us since I’m out of ideas.

  • Mat

I talked with one of our PVF engineers and she’d like to work you via email since it;s faster than the UF, to try and determine the problem. Please send a note to trs@pgroup.com and ask customer service to forward your message to me (Mat) and I’ll pass it along.

Thanks,
Mat