- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Guys,
I m with an error that a really do not understand. The code is really simple:
module grids
contains
subroutine get_conic_parameters(pts,fcl, X)
use lslrg_int, only: d_lslrg ! IMSL subroutine
implicit none
doublecomplex , intent(in) :: pts(4)
doubleprecision , intent(in) :: fcl(4)
doubleprecision , intent(out) :: X(4)
doubleprecision :: sme, A(4,4), B(4)
integer :: jk
do jk = 1, 4
sme = cdabs(pts(jk))*cdabs(pts(jk))
A(jk,1) = -dexp(-fcl(jk))
A(jk,2) = 2.0d0*dreal(pts(jk))
A(jk,3) = 2.0d0*dimag(pts(jk))
A(jk,4) = sme - 1.0d0
B(jk) = sme + 1.0d0
enddo
call d_lslrg(A,B,X)
return
end subroutine get_conic_parameters
module grids
Errors:
Error 1 error LNK2019: unresolved external symbol D_LSLRG referenced in function GRIDS_mp_GET_CONIC_PARAMETERS grids.obj
Error 2 fatal error LNK1120: 1 unresolved externals x64\Debug\OffsetShaper.exe
I use this instructions https://software.intel.com/en-us/articles/installing-and-using-the-imsl-libraries to config IMSL.
Thank you very much for help.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, I recommend that you call LSLRG, not D_LSLRG. Let the generic resolution work for you.
Second, make sure that you have added the line:
incluide 'link_fnl_shared.h'
in one of your sources.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Rafael, you have two items to fix. One is to tell the the linker to search the IMSL libraries, as Steve pointed out. The second is that your call to D_LSLRG has the wrong calling sequence. The generic Fortran 90 interface has three required arguments plus more optional arguments. The Fortran 77 interface has six required arguments, whereas in your code you provide only three.
Make your choice between the F90 and F77 interfaces but, having done that, issue a call that is consistent with that choice. I suggest that you replace D_LSLRG by LSLRG in the CALL statement and the USE statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Friends,
Thank you for answer. I made the changes suggested (change d_lslrg by lslrg), but the problem remains the same:
I don’t know if the problem is some config (I follow exactly the Steve tutorial for IMSL) or not. But, in another file solution, the same subroutine work with no problem.
Indeed, I was not using incluide 'link_fnl_shared.h' (neither in the orther solution where this subroutine works fine).
I tried put in header of main program but does not work. Is it the right place?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are a number of ways of linking in the IMSL libraries, depending on whether you build at the command line or using Visual Studio. If building at the command line, adding the /Qimsl option is sufficient for most purposes.
If you are using Visual Studio, please retrieve and report the linker command line used (from the project/solution settings), or post the build log after a failed build.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The main program is fine for the INCLUDE. However, mecej4 points out another error that could cause this problem and I don't know if you fixed that. Can you show us the corrected code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Corrected code:
subroutine get_conic_parameters(pts,fcl, X)
use lslrg_int, only: lslrg
implicit none
doublecomplex , intent(in) :: pts(4)
doubleprecision , intent(in) :: fcl(4)
doubleprecision , intent(inout) :: X(4)
doubleprecision :: A(4,4), B(4)
doubleprecision :: sme, fa1, fa2, fa3, fa4, detA
integer :: jk
do jk = 1, 4
sme = cdabs(pts(jk))*cdabs(pts(jk))
A(jk,1) = -dexp(-fcl(jk))
A(jk,2) = 2.0d0*dreal(pts(jk))
A(jk,3) = 2.0d0*dimag(pts(jk))
A(jk,4) = sme - 1.0d0
B(jk) = sme + 1.0d0
enddo
call lslrg(A,B,X)
return
end subroutine get_conic_parameters
end module grids
Here the log:
Linking... Link /OUT:"x64\Debug\OffsetShaper.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Debug\OffsetShaper.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Users\rafael.penchel\documents\visual studio 2010\Projects\OffsetShaper\OffsetShaper\x64\Debug\OffsetShaper.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\Users\rafael.penchel\documents\visual studio 2010\Projects\OffsetShaper\OffsetShaper\x64\Debug\OffsetShaper.lib" "x64\Debug\quadrics.obj" "x64\Debug\grids.obj" "x64\Debug\main.obj" Link: executing 'link' grids.obj : error LNK2019: unresolved external symbol D_LSLRG referenced in function GRIDS_mp_GET_CONIC_PARAMETERS x64\Debug\OffsetShaper.exe : fatal error LNK1120: 1 unresolved externals OffsetShaper - 2 error(s), 0 warning(s) |
Thanky you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't get errors when I build with your code, but you haven't shown the INCLUDE line for link_fnl_shared.h nor if there are any compiler errors.
Please set the project property Linker > General > Show Progress to "Display all progress messages" and rebuild. Create a ZIP of the buildlog,htm and attach it to a reply here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You had said earlier that you put in the INCLUDE line, so I wondered why it didn't work. You have to tell the compiler/linker the names of the IMSL libraries to link to. This can be done by naming them individually in the Linker properties, or using the INCLUDE file.
Everything works now?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think i find the problem:
In the solution where It was working corretly it was set in Linker> Input > additional dependencies imsl_dll.lib.
So, I Do this in the solution with problems and works fine without INCLUDE 'link_fnl_shared.h'.
That's it!.
Is there a best practice?
Thank you very much Steve and mecej4.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Best practice is to use the INCLUDE as the names of the libraries change over time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is exactly this Steve.
I always did this for linker, never from the command line. Everything is working now!
Thank you very much!

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