问题
I am using SIFT algorithm code by Rob Hess which uses OpenCV library, in Windows. And I am having visual studio 2008 as the IDE. When I run the program for image matching having Debug as the Solution Configuration in VS There is no problem, everything works fine. But when i change the Solution Configuration to Release it gives a linking error.
The error is:
Linking... LINK : fatal error LNK1181: cannot open input file 'libgsl.a'
Can someone explain me the reason and tell me how to resolve this.
Thank you
回答1:
Finally found it
Yes I was missing some libraries. libgsl.a comes in GnuWin32 gsl package. This can be downloaded from sourceforge. There is a directory named gsl in the list displayed. I downloaded gsl-1.8-lib.zip and extracted it to C:\GnuWin32 in my computer.
Next I included the library to Visual Studio. Here are the steps which I found from this webpage. Although these are part of an unsuccessful try (according to the orginal post) this worked very well for me
Within VisualStudio, go to File->New->Project, then "Visual C++ Projects," then "Win32," then "Win32 Console Application." Enter a name and click "OK." On the next screen click "Finish."
In the "Solution Explorer," right click on the name of your project and go to "Properties."
Under Configuration Properties->Linker->General->Additional Library Directories, type in "C:\GnuWin32\lib"
Under Configuration Properties->Linker->Input->Additional Dependencies, type in "libgslcblas.a libgsl.a"
Under Configuration Properties->C/C++->General->Additional Include Directories, type in "C:\GnuWin32\include"
Under Configuration Properties->C/C++->Code Generation->Runtime Library,select "Multi-threaded DLL"
It works fine now. Thank you for every one who tried
回答2:
maybe you have forgotten to set up your lib paths in the Release configuration.
来源:https://stackoverflow.com/questions/3132680/linking-link-fatal-error-lnk1181-cannot-open-input-file-libgsl-a