HELP to compile with LibRaw QT / MingW64 / Windows 8

Hi,
I'm new with LibRaw. l know well Qt and C++
My configuration is : - Windows 8.2 - Qt version Qt5.14.1 : MingW64 bits : all work fine

I made a very simple project with Qt to open a raw file

--------------------- The pro file is : ---------------------------------------
# LIBRAW : for all headers/sources libraw.h ...
INCLUDEPATH += C:\LibRaw-0.19.5\LibRaw
# Path to librairies ( I use only libraw.dll that is in the bin folder )
LIBS += -LC:\LibRaw-0.19.5\bin
-llibraw.dll
----------------------------------------------------------------------------------
------------------------ My source code is ------------------------------
#include "libraw.h"

void Dialog::on_pushButton_clicked() {
LibRaw *processor = new LibRaw ;
processor->open_file("C:/Test.cr2") ;}
---------------------------------------------------------------------------------

When compiling QT/MingW64 i get these ERROR MESSAGES after many warnings :

----------------------------------
C:\Users\Lucien\Desktop\Dialog_raw\Raw\dialog.cpp:28: erreur : undefined reference to _imp__ZN6LibRawC1Ej'

C:\Users\Lucien\Desktop\Dialog_raw\Raw\dialog.cpp:29: erreur : undefined reference to `__imp__ZN6LibRaw9open_fileEPKcx'
----------------------------------

Can you help me ? Thanks a lot,

Lucien
lucien2900@yahoo.fr

Forums: 

LibRaw dll coming with binary

LibRaw dll coming with binary distributions is built using MS Visual Studio.

It is very likely that C++ name mangling (AND C++ library too!) is not compatible with gcc/MinGW.

You need to rebuild LibRaw using your compiler (Makefile.mingw should help)

-- Alex Tutubalin @LibRaw LLC

libraw.a not linked well ?

Hello Alex,
Thanks a lot for your job about LibRaw and FastRawViewer !

To solve my problem of using libraw librairy in Windows8.2 / Qt / C++ / MingW64, and according to your answer ( if i understand well )
i just done this :

> mingw32-make - f Makefile.mingw
This create the librairy : libraw.a with my mingw compiler 64 bits
libraw.a is 1183 ko in /lib folder.

In my minimal project !
i declare the librairy, and the Include/header and try to use it : As above in my first message

LibRaw *processor = new LibRaw ;
processor->open_file("C:/Test.cr2") ;

When i compile i still have errors like ; undefined reference to symbols...

I don't understand what is wrong with the linking.

Thanks Alex,

Lucien

make sure you're linking with

make sure you're linking with (newly created) libraw.a, not (older) libraw.dll

-- Alex Tutubalin @LibRaw LLC

libraw.a not linked well ?

Alex,

I have removed any .dll or . a librairy before compiling.
Just i use libraw.a as soon as created

( I am probably a dummy with librairies )

In my project just i have this :

INCLUDEPATH += C:\LibRaw-0.19.5\libraw
LIBS += -LC:\LibRaw-0.19.5\lib -llibraw.a
and :
#include

I have still the trouble with static library. but '.exe' files in /bin work well !.

Lucien

libraw.a not linked well ?

For the static library, you must define LIBRAW_NODLL when compiling programs that link to it.

You need this only for

You need this only for Microsoft or Intel compilers. For others LIBRAW_WIN32_DLLDEFS is not defined automatically.

-- Alex Tutubalin @LibRaw LLC