Question for LibRaw installation

AttachmentSize
Plain text iconlibRaw_Log.txt5.21 KB

Hi guys,
I know a few people have asked this question, but no satisfied answer that I can find. So please help:

I am trying to install on Windows and using with visual studio.
And I don't understand this line in documentation:
"Set the environment parameters so that the compiler/linker would find the libraries and include-files. For Visual C++, this is done by running vcvars32.bat."

In the zip folder, I can find only the "lib" folder but no "include" folder.
What I did is that I go in to system environment variables, add the path to folder "LibRaw-0.19.5". Then I open cmd, type this:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
nmake -f Makefile.msvc

But the log show could not find libraw_static.lib. I have checked and sure that the lib is in the link. Please see the log attached.

Hope to get some help. Thanks.

Forums: 

LibRaw 0.19 Win32 binary

LibRaw 0.19 Win32 binary distribution (downloadable from this site /download page) is built using
nmake -f Makefile.msvc

I do not know what is wrong on your system.

-- Alex Tutubalin

I have the answer

Hi Alex,
I use the prebuilt library for win 64 and successfully embedded into visual studio. I would like to share my method as following:
1. Extract the binaries for x64.
2. Go into visual project. Open Project Properties, In Configuration Properties:
a. /Debugging/Enviornment: add the path to LibRaw-xxx\bin
b. /C/C++/General/Additional Include Directories: add the path to LibRaw-xxx\
c. /Linker/General/Additional Library Directories: add the path to LibRaw-xxx\lib
/Linker/Input/Additional Dependencies: add libraw.lib and libraw_static.lib
My testing code is following:

#include "libraw/libraw.h"
#include "opencv2/highgui/highgui.hpp"
#include "iostream"
#include "stdio.h"

using namespace std;
using namespace cv;

int main() {
// Let us create an image processor
LibRaw iProcessor;
// Open the file and read the metadata
iProcessor.open_file("D:/[01]Luan_van_thac_si/PROJECT/Non_Cuda/SLIC/SLICSuperPixel/DSC01042.ARW");

// The metadata are accessible through data fields of the class
cout << "Image width = " << static_cast(iProcessor.imgdata.sizes.width)
<< ", Image height = " << static_cast(iProcessor.imgdata.sizes.height) << endl;

waitKey();
return 0;
}

Results: Image width = 6024, Image height = 4024

I hope this answer will help other users and thanks for wonderful library!

vcvars32.bat

I have had trouble with this for years
Not there
Not where if is suppose to be
Permission problems
Different versions

In the end it is so much easier to use a different compile
Like mingw