- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm having a hard time creating my own math library.
Here's what I did.
1. Build a static library by selecting the Fortran Static Library project type.
So 'my_lib.lib' is created in the folder visual studio 2005>projects>my_lib>my_lib>x86>debug.
It includes, among others, module 'matrix'.
2. Then add 'my_lib.lib' to the main project via project>add existing item>choose 'my_lib.lib'
The main program is as follows.
program main
use matrix
implicit none
...
3. Build the solution.
Then I get the following error message.
Error 1 Error: Error in opening the compiled module file. Check INCLUDE paths. [MATRIX]
Since I'm a beginner in Fortran, it's hard to figure out what's wrong, and the manual is not that helpful.
I tried
(1) tools>options>fortran>general>specify library directory as the foler where 'my_lib.lib' is located
(visual studio 2005>projects>my_lib>my_lib>x86>debug )
(2) project>properties>linker>input>additional dependencies>type 'my_lib.lib'
But it still doesn't work.
Thanks.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do not cofuse the compile step with the link step.
The message you show is a compile message.
You need to tell the compilerwhere to find the module that "program" is USEing.
In the project when you compile your module there is an "outputdirectory" When youbuild your module project the .mod file(s) and the .lib are placed there.
So in Projects->Properties under the Fortran->General dialog you need to put that directoryin "Additional include files" so that the compiler can access the .mod file for "program" (or whatever else"uses" the module)
Then inthe linker step itneeds access to the .lib file in order to produce the final product - exe or whatever.
hth
Les
The message you show is a compile message.
You need to tell the compilerwhere to find the module that "program" is USEing.
In the project when you compile your module there is an "outputdirectory" When youbuild your module project the .mod file(s) and the .lib are placed there.
So in Projects->Properties under the Fortran->General dialog you need to put that directoryin "Additional include files" so that the compiler can access the .mod file for "program" (or whatever else"uses" the module)
Then inthe linker step itneeds access to the .lib file in order to produce the final product - exe or whatever.
hth
Les
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have a little confusion as to the roles of module and library files in the build process. Module files are sought by the compiler when it encounters a USE statement. After all source files have been compiled, the linker is given control and it looks for library files.
Having the library file in the correct place does nothing for the compiler and having the module file in the correct place does nothing for the linker.
Having the library file in the correct place does nothing for the compiler and having the module file in the correct place does nothing for the linker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using VS2010, to assosiate the .lib project with the .exe project in the solution, you right click the .exe project icon, select Project Dependencies, then click the name of the .lib project.
hth
hth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do not cofuse the compile step with the link step.
The message you show is a compile message.
You need to tell the compilerwhere to find the module that "program" is USEing.
In the project when you compile your module there is an "outputdirectory" When youbuild your module project the .mod file(s) and the .lib are placed there.
So in Projects->Properties under the Fortran->General dialog you need to put that directoryin "Additional include files" so that the compiler can access the .mod file for "program" (or whatever else"uses" the module)
Then inthe linker step itneeds access to the .lib file in order to produce the final product - exe or whatever.
hth
Les
The message you show is a compile message.
You need to tell the compilerwhere to find the module that "program" is USEing.
In the project when you compile your module there is an "outputdirectory" When youbuild your module project the .mod file(s) and the .lib are placed there.
So in Projects->Properties under the Fortran->General dialog you need to put that directoryin "Additional include files" so that the compiler can access the .mod file for "program" (or whatever else"uses" the module)
Then inthe linker step itneeds access to the .lib file in order to produce the final product - exe or whatever.
hth
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. It works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Although this issue is apparently solved, I sympathise with plyuongmin. Building a complete solution, complete with multiple source files, module files, external and internal subroutines, multiple static libraries, and multiple dynamic link libraries, is complicated. And when one is trying to learn Visual Studio along with Fortran it gets worse. And he is right, the documentation is not helpful.
It would be very helpful if someone at Intel could write a chapter in the user's guide to cover this.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page