Add new comment

Use LibRaw with CodeBlocks and mingw on windows

Hi everyone,

I would like to open a .cr2 (from my Canon 6D) file, play with it and compare the result with already existing demosaicing algorithms.
I use codeblocks 16.01, mingw x64 5.0.3 (g++ version 7.2.0) and openCV 3.3.1 on Windows 10 x64.
I downloaded the latest LibRaw sources.
But i can't compile a simple program :

#include <iostream>
#include "libraw.h"
using namespace std;
int main()
{
        LibRaw iProcessor;
        iProcessor.open_file("raw_sample.cr2");
        return 0;
}

I get some undefined reference to functions : imp_htonl , imp_htons, imp_ntohs , imp_ntohl ...

Here exactly what I've done :

In Windows' powershell in the LibRaw folder I type :
./configure --enable-demosaic-pack-gpl2 --enable-demosaic-pack-gpl3
then :
mingw-make -f ./Makefile.mingw

It compiles some files, then I get an kind of error (missing libraw.a) and it compiles again with no error.
At the end, I have "libraw.a" (1.1Mo) in the LibRaw/lib folder, and some "libraw_xxxx.h" in the LibRaw/libraw folder.

In CodeBlocks, I add the LibRaw/libraw folder in the compiler's search directory, LibRaw/lib in the linker's search directory, and finally I add the "libraw.a" in the linker ressources.

And I get those undefined reference when I try to compile.

I've been googling those function for hours but I found nothing.

Thank you for your help ;)

Forums: