Bug #584

linking fails for PreviewImage::pData()

Added by drhex - about 10 years ago. Updated about 10 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Andreas Huggel% Done:


Target version:0.18


This short example program demonstrates the problem:

#include <exiv2/image.hpp>
#include <exiv2/preview.hpp>

void process(const unsigned char *data, unsigned int length) {

int main(int argc, char *argv[]) {
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open("testfile.jpg");
if (!image->good()) return 1;
Exiv2::PreviewManager loader(*image);
Exiv2::PreviewPropertiesList list = loader.getPreviewProperties();
if (list.size() <= 0) return 1;
Exiv2::PreviewImage pimage = loader.getPreviewImage(list0);
process(pimage.pData(), pimage.size());

return 0;

I compile the above with

g++ -Wall -lexiv2 exivtest.cc

using gcc version 4.1.3 20070929 (prerelease) on Ubuntu 7.10 and the output is

/tmp/ccZU0Iyb.o: In function `main':
exivtest.cc:(.text+0x221): undefined reference to `Exiv2::PreviewImage::pData() const'
collect2: ld returned 1 exit status

I have also tested on Debian lenny/sid with gcc version 4.3.2 with the same result. No compile errors, only linking problems and only for one of the exiv2-functions used in the code (there are no errors if I comment out the line that calls pData()).

Tested with the tar.gz-version of exiv2.0.18-pre2


#1 Updated by Andreas Huggel about 10 years ago

Oops, the implementation of this method is missing.
Just add this to preview.cpp:

const byte* PreviewImage::pData() const
return pData_;

#2 Updated by drhex - about 10 years ago

That worked fine, thanks.

#4 Updated by Andreas Huggel about 10 years ago

  • % Done changed from 0 to 100

#5 Updated by Andreas Huggel about 10 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux