Hi all,
I am currently trying to compile the test examples mem_image.cpp with code::blocks software and I get some undefined reference problems:
undefined reference to `__getreent' undefined reference to `__errno' undefined reference to `fseeko' undefined reference to `ftello' undefined reference to `getc_unlocked'
I was wondering if there was any compiler flag I have to add to code blocks mingw compiler to resolve them, but I can't find any lib in CodeBlocks/MinGW folder that solves the problem.
I tried to add the libpthread.a lib of my cygwin/lib folder, that solves the _getreent reference but not the other ones; moreover, I'm using libraw_r.a which is supposed to be thread_safe...
So I was wondering if anyone already built a LibRaw example with code::blocks and could help me
Just in case, I give you the complete log (main.cpp is the renamed file mem_image.cpp) :
-------------- Clean: Debug in libraw_test --------------- Cleaned "libraw_test - Debug" -------------- Build: Debug in libraw_test --------------- Compiling: main.cpp C:\Users\g.bittoun\Documents\Projects\libraw_test\main.cpp:122:1: warning: "OUT" redefined In file included from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/../../../../include/rpc.h:40, from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/../../../../include/windows.h:82, from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/../../../../include/winsock2.h:22, from C:\Users\g.bittoun\Documents\Projects\libraw_test\main.cpp:35: c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/../../../../include/rpcdce.h:14:1: warning: this is the location of the previous definition Linking console executable: bin\Debug\libraw_test.exe C:\Program Files (x86)\LibRaw-0.13.0-Beta3\lib/libraw_r.a(lib_libraw_r_a-libraw_cxx.o): In function `ZN22LibRaw_file_datastream3eofEv': /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/memory:(.text+0x7): undefined reference to `__getreent' C:\Program Files (x86)\LibRaw-0.13.0-Beta3\lib/libraw_r.a(lib_libraw_r_a-libraw_cxx.o): In function `default_data_callback': /cygdrive/c/Program Files (x86)/LibRaw-0.13.0-Beta3/src/libraw_cxx.cpp:51: undefined reference to `__getreent' /cygdrive/c/Program Files (x86)/LibRaw-0.13.0-Beta3/src/libraw_cxx.cpp:49: undefined reference to `__getreent' C:\Program Files (x86)\LibRaw-0.13.0-Beta3\lib/libraw_r.a(lib_libraw_r_a-libraw_cxx.o): In function `ZN6LibRaw21dcraw_ppm_tiff_writerEPKc': /cygdrive/c/Program Files (x86)/LibRaw-0.13.0-Beta3/src/libraw_cxx.cpp:1114: undefined reference to `__errno' C:\Program Files (x86)\LibRaw-0.13.0-Beta3\lib/libraw_r.a(lib_libraw_r_a-libraw_cxx.o): In function `ZN6LibRaw18dcraw_thumb_writerEPKc': /cygdrive/c/Program Files (x86)/LibRaw-0.13.0-Beta3/src/libraw_cxx.cpp:1387: undefined reference to `__errno' C:\Program Files (x86)\LibRaw-0.13.0-Beta3\lib/libraw_r.a(lib_libraw_r_a-libraw_cxx.o): In function `ZN22LibRaw_file_datastream3eofEv': /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/memory:(.text$_ZN25LibRaw_bigfile_datastream4seekExi[LibRaw_bigfile_datastream::seek(long long, int)]+0x39): undefined reference to `fseeko' /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/memory:(.text$_ZN25LibRaw_bigfile_datastream4tellEv[LibRaw_bigfile_datastream::tell()]+0x25): undefined reference to `ftello' /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/memory:(.text$_ZN25LibRaw_bigfile_datastream8get_charEv[LibRaw_bigfile_datastream::get_char()]+0x25): undefined reference to `getc_unlocked' C:\Program Files (x86)\LibRaw-0.13.0-Beta3\lib/libraw_r.a(lib_libraw_r_a-dcraw_fileio.o): In function `ZN6LibRaw8subtractEPKc': /cygdrive/c/Program Files (x86)/LibRaw-0.13.0-Beta3/internal/dcraw_fileio.cpp:127: undefined reference to `__getreent' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 9 errors, 2 warnings
If you need more elements, don't hesitate to ask.
Thanks
PS : I promess, I asked google before coming here...
Problem solved, Hurray
Problem solved, Hurray !!!
And it was not so complicated. In case of anyone having the same problem :
- Download the win32 zip of LibRaw (available on this website)
- open the makefile.mingw present in the LibRaw root folder and add the option "-mno-cygwin" to the cflags (this was obvious...)
- rename the Makefile.mingw in Makefile
- compile LibRaw using cygwin and make
You will now have a libraw.a present in the lib folder of LibRaw. This library can be used with codeblocks. You'll probably need to add the ws2_32 lib just after the libraw lib or you'll get undefined references to ntohs4.
Regards