Static build of libraw for windows 64bit

Hello,

I understand this is probably a naive question, but I've been trying to make a static build using /mt flag in visual studio. I downloaded LibRaw 18 from the git repository and built the libjpeg-turbo, added the paths to libraries in LibRaw solution and I am trying to build it. I continually get this error

Error 102 error LNK2019: unresolved external symbol _uncompress referenced in function "protected: void __thiscall LibRaw::deflate_dng_load_raw(void)" (?deflate_dng_load_raw@LibRaw@@IAEXXZ) C:\Users\HP\Documents\LibRaw\LibRaw-master\buildfiles\libraw_cxx.obj libraw

Forums: 

Libraw 0.18 (development

Libraw 0.18 (development branch) needs zlib (zlib.net) to support deflated DNG files.

This it to be changed (this dependency will change to optional) in some future update before 0.18-release.

-- Alex Tutubalin

Re: zlib.

I did download zlib.h and zconf.h added to include files. Or I should build it and add as a dependency? Are there any other external dependencies that I should be aware of? like perhaps libjpeg?

You need to build it and add

You need to build it and add as a dependency.

All other dependencies (e.g. libjasper for jpeg2000 files) are optional, including jpeg (you can build libraw without jpeg compression support).

This one is not yet, because 0.18 branch is far from finished

-- Alex Tutubalin

Hi again, I built zlib and

Hi again, I built zlib and added it to dependencies and now I am getting

Error 11 error LNK1181: cannot open input file 'release\dcraw_emu.obj' C:\Users\HP\Documents\LibRaw\LibRaw-master\buildfiles\LINK dcraw_emu

Error 34 error LNK1181: cannot open input file 'release\dcraw_fileio.obj' C:\Users\HP\Documents\LibRaw\LibRaw-master\buildfiles\LINK libraw

And these errors.

Hi again,

Hi again,

So I've managed to build the libraries, but when I try to link to my project I am getting the following errors

main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl LibRaw::open_file(char const *,__int64)" (__imp_?open_file@LibRaw@@QEAAHPEBD_J@Z) referenced in function GetColordataBlack

and more like it, what might be the issue?

Have you defined LIBRAW_NODLL

Have you defined LIBRAW_NODLL on library and your application build?

If not, LibRaw will link as dllexport, while your app expect it as dllimport (more details are in libraw_types at DllDef define)

-- Alex Tutubalin

I didn't define it as LIBRAW

I didn't define it as LIBRAW_NODLL, but even after fixing that the same errors remain.

#ifdef WIN32
#ifdef LIBRAW_NODLL
# define DllDef
#else
# ifdef LIBRAW_BUILDLIB
# define DllDef __declspec( dllexport )
# else
# define DllDef __declspec( dllimport )
# endif
#endif
#else
# define DllDef
#endif

this how the libraw_types now looks like

Sorry, I cannot continue this

Sorry, I cannot continue this way.

Please use
1) release library (LibRaw 0.17), not development branch
2) Build the static library using
nmake -f Makefile.msvc
and use lib\libraw_static.lib for your application.

-- Alex Tutubalin