FREE_IMAGE_FORMAT include issue

I am studying through image manipulation example in “OpenCL programming guide 978-0-321-74964-2”, had to a lot of code adjustment as the book itself appears to have focused on the very early version of opencl and many of the functions in the example simply might have deprecated.

I am coming across a 2D image manipulation example in it s p284 where it uses the FREE_IMAGE_FORMAT identifier and related other def-s which is causing build error. Before posting here, sniffed around internet a bit, and found that the book’s own full example does include following line:
#include “FreeImage.h”

The book itself does not mention about anything and has partial code not it does not tell how to setup for these additional definitions outside the opencl code.

It appears it is maintained by opensource freeimage org:
Not sure what repository (github etc.) I can use to properly setup though.

I am finding following github repo containing several VS sln project. It definitely has something about including freeimage.h similar statement in the example…

The source folder definitely has that header file.

Some progress, I can include freeimage.h now linker problem is the one remaining. Apparently, I dont see or something similar available for linker to use but there is a windows VS version of lib availabie in freeimagelib folder:

root@guyen-MS-7B22:/ ls -ltr
total 80
-rw-r–r-- 1 root root 13513 Jul 27 16:39 FreeImageLib.2013.vcxproj.filters
-rw-r–r-- 1 root root 20641 Jul 27 16:39 FreeImageLib.2013.vcxproj
-rw-r–r-- 1 root root 17337 Jul 27 16:39 FreeImageLib.2008.vcproj
-rw-r–r-- 1 root root 17139 Jul 27 16:39 FreeImageLib.2005.vcproj

I am going to have search if linux so can be built using the source.

Without it, I am getting linker error:

g++ -o p284 p284.o -lOpenCL -L/opt/rocm/opencl//lib/x86_64 -L/
p284.o: In function loadImage(_cl_context*, char*, int&, int&)': p284.cpp:(.text+0x35): undefined reference to FreeImage_GetFileType’
p284.cpp:(.text+0x4e): undefined reference to FreeImage_Load' p284.cpp:(.text+0x66): undefined reference to FreeImage_ConvertTo32Bits’
p284.cpp:(.text+0x76): undefined reference to FreeImage_Unload' p284.cpp:(.text+0x82): undefined reference to FreeImage_GetWidth’
p284.cpp:(.text+0x96): undefined reference to FreeImage_GetHeight' p284.cpp:(.text+0xea): undefined reference to FreeImage_GetBits’
p284.cpp:(.text+0x10b): undefined reference to `FreeImage_Unload’
collect2: error: ld returned 1 exit status
Makefile:17: recipe for target ‘p284’ failed
make: *** [p284] Error 1

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.