- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I am trying to use the NAG library with Intel Fortran using Visual Studio. Here is what I have done in Visual Studio:
In Visual Studio, Menu Tools -> Options -> Intel Compilers and Libraries -> Visual Fortran -> Compilers
add to Libraries:
C:\Program Files\NAG\NL29\nlw6i29del\lib
add to Include:
C:\Program Files\NAG\NL29\nlw6i29del\include
I am getting an error message as follows:
error #7002: Error in opening the compiled module file. Check INCLUDE paths. [NAG_LIBRARY]
Any hints of what I am doing wrong?
Many thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does a file called NAG_LIBRARY.mod (case doesn't matter) exist in C:\Program Files\NAG\NL29\nlw6i29del\include ? Does the NAG Library documentation perhaps tell you to compile a NAG_LIBRARY.f90 into a .mod file?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many thanks, Steve.
I did find a NAG_LIBRARY.mod file in another folder and am now directing to it in "Additional Include Directories". It's now compiling.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a file called envvars.bat in the batch directory of the NAG library installation that sets up the correct environment. If that environment is not set up before you run Visual Studio, the necessary module files will not be found.
Note that the include directory contains C include files. The Fortran mod files are in the subdirectory nag_interface_blocks, and that directory must be accessible through %INCLUDE% or by specifying the appropriate /I or /module: options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, I did add the nag_interface_blocks path to "Additional Include Directories". It's now working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi again. I was able to compile my program using the USE line below:
Use nag_library, Only: e01daf, e02dff, nag_wp, x04cbf
However, once I effectively call subroutine e01daf, I receive two errors:
error LNK2019: unresolved external symbol e01daf
error LNK1120: unresolved externals
I suspect I should be pointing the compiler to yet another directory, but I am unsure which one.
I added these two directories under "Additional Library Dependencies":
C:\Program Files\NAG\NL29\nlw6i29del\lib
C:\Program Files\NAG\NL29\nlw6i29del\bin
Many thanks for any help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Messages with "...unresolved external symbol..." are from the linker, not the compiler. You have to choose which NAG library you wish to use (dynamic/static, NAG/MKL, etc., please read the NAG users note for details), and specify this library in your project settings. If you add only the NAG library directory in your project settings, that is not enough -- it tells VS where to find libraries, but not which libraries to use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much for these comments.
I was able to find the relevant documentation here: https://www.nag.com/doc/inun/nl29/w6idel/un.html -- they have detailed instructions for linking the NAG library with Visual Studio, which I followed multiple times. Still, I am getting the error messages attached (as a screenshot). Any hints?
Very grateful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I used another library (NLW6I29DE_mkl.lib) and it worked. I believe I had to add other dependencies for the one I selected below.
In any case, many thanks for the help so far!

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