PVF can't find module/library

Hi,

I have successfully included and linked two c static libraries with my PVF program project but when I try to add a fortran static library or module project (which compile OK as separate projects) I get ‘cannot open file xxx.lib or xxx.mod’.

Is there some path than needs to be set (PVF not command line) for these fortran modules that is different than the ones for the c static library projects?

I am new at the developer studio environment and I could find no mention of this in the documentation.

gfwright

In your Property Pages:

For module file:
Click:Fortran->Output->Module Path
Enter your module paths here.

For .lib file:
Click: Linker-> General ->Additional Library Directories
Enter Path to your libraries
Click: Linker -> Input -> Additional Dependencies
Enter the libraries

If you have more than one path or libraries, enter on a separate line by clicking on the […] button located on the right most of that line.

Hongyon

Thanks for the reply. It worked (I tried the one for the module file).

But now I get the following error:
Error 1 invalid or corrupt file: cannot read at 0x3D0A D:\PVF\test\ib_limutils\ib_limutils\Win32\Debug\ib_limutils.mod

I deleted the old module file project and rebuilt it but I still get the same error. Any ideas?

Getting use to this new Visual environment is a challenge for an old FORTRAN 66 programmer.

Greg Wright

It is me again,

I did some further testing and following your instruction for the .lib file I added the path to the .lib that was created, which was not done when I recieved the above error message.

Unfortunately, a new error cropped up:
Error 2 unresolved external symbol ib_limutils Lib_test.obj
ib_limutils is the name of the module. The error is generated when the compiler comes to the ‘use ib_limutils’ line in my fortran source.
Again, any ideas?

Greg Wright

Hi Greg,

I am not quite sure that happened. This is all 32-bit and all fortran, right?

How did you create your library? Did you make another project to create a library? Typically, you need to create a project for each library. I would put source in different directories for each project.

Hongyon

Thanks again for your reply!

Here is the situation as it stands. I have two static libraries based on C and one module in PVF. The calling program has no problem linking to and using the subroutines in the C libraries but the PVF module will not link and so I get an ‘unresolved external symbol limutils’ error for the PVF module (which is named limutils).

The Solution consists of four projects, one for the calling program, one for each C library, and one for the module. The module project builds with no errors (as do the other modules). When I comment out the ‘use’ statement in the calling program it compiles and runs OK. All projects are in seperate directories.

I also followed your instructions on setting the paths.

Hopefully this explains the problem better.

Greg Wright

Greg,

How do you set up your module project? As a Console Application, Dynamic library, static library, etc.

If your module project contains modules that will be used only by your main project(or calling program). I would put them together in the same project as the main project.

When you say your PVF module will not link, what do you mean? Is PVF module project creating an executable or the main project cannot link to module project(and it shouldn’t).

Hongyon

Hongyon,

My module project is presently set up as a static library, none of the other project types seemed to apply.

If I put the module in the main project where would I put it? In the include files, the resource files, or the source files section? Or would you just append it to the end of the main program source code? This is the first time I have attempted to use a module, they didn’t exist the last time I programmed in Fortran.

Well, what I mean about no linking is when I do a build on the main program I get the unresolved external symbol for the name of the module and no executable. If I comment out the ‘use modname’ line the the main program it will build with no errors.

Thanks,
Greg

Greg,

You can put those module files in the same directory where you put the source for main project. There are fortran files, right?
Then, remove the module project from your solution.
Modify the module path and library path in the main project according to your change.

Hopefully this will fix your problem.


Hongyon

Thanks Hongyon2

This worked and I am thankful for your help and understanding. It is hard to teach an old dog new tricks.

Again,
Thanks

Greg Wright