linking libraw in Linux

I tried your simple demo program.
It compiles OK but none of the symbols are found by the linker.
What am I missing?

My build command:
$ g++ -lraw -o readraw readraw.cpp

Error messages returned:
/tmp/ccDvzTRc.o: In function `main':
readraw.cpp:(.text+0x4a): undefined reference to `LibRaw::LibRaw(unsigned int)'
readraw.cpp:(.text+0x68): undefined reference to `LibRaw::open_file(char const*, long long)'
readraw.cpp:(.text+0x9c): undefined reference to `LibRaw::unpack()'
readraw.cpp:(.text+0xab): undefined reference to `LibRaw::raw2image()'
readraw.cpp:(.text+0x187): undefined reference to `LibRaw::recycle()'
readraw.cpp:(.text+0x19b): undefined reference to `LibRaw::~LibRaw()'
readraw.cpp:(.text+0x1c0): undefined reference to `LibRaw::~LibRaw()'
collect2: error: ld returned 1 exit status

Here is my test program in full:

#include "libraw/libraw.h"
 
int main(int argc, char *argv[])
{
   char  *file = argv[1];
 
   LibRaw RawProcessor;
   RawProcessor.open_file(file);
   printf("Image size: %d x %d\n",RawProcessor.imgdata.sizes.width,RawProcessor.imgdata.sizes.height);
   RawProcessor.unpack();
   RawProcessor.raw2image();
 
   for(int ii = 0; ii < RawProcessor.imgdata.sizes.iwidth * RawProcessor.imgdata.sizes.iheight; ii++)
   {
      printf("i=%d R=%d G=%d B=%d G2=%d\n", ii,
         RawProcessor.imgdata.image[ii][0],
         RawProcessor.imgdata.image[ii][1],
         RawProcessor.imgdata.image[ii][2],
         RawProcessor.imgdata.image[ii][3]  );
   }
 
   RawProcessor.recycle();
   return 0;
}

Forums: 

Place libraries *after* your

Place libraries *after* your sources in linker command line:

g++ main.cpp -o readraw -lraw -lm

-- Alex Tutubalin @LibRaw LLC