Help compiling exifprint
Added by Nathan Sullivan about 12 years ago
I'm having some problems. I just installed exiv2. I attempted to compile the exifprint sample and I got the following error from eclipse:
**** Build of configuration Debug for project cs414_exif **** make all Building file: ../test.cpp Invoking: GCC C++ Compiler g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test.d" -MT"test.d" -o"test.o" "../test.cpp" Finished building: ../test.cpp Building target: cs414_exif Invoking: MacOS X C++ Linker g++ -o "cs414_exif" ./test.o Undefined symbols: "Exiv2::ImageFactory::open(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from: _main in test.o "Exiv2::Error::setMsg()", referenced from: Exiv2::Error::Error<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in test.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [cs414_exif] Error 1
I'm pretty sure it's something like I'm not linking to the exiv2 library, but I don't know how to do that.
Any suggestions?
Replies (3)
RE: Help compiling exifprint - Added by Robin Mills about 12 years ago
If you have a simple project (for example exifprint.cpp in the samples directory), you can compile and link with a single command:
g++ exifprint.cpp -lexiv2 -o exifprint
The option -lexiv2 means link the library call libexpat.a (and g++ searches in various default locations such as /usr/local/lib and the like). If you've build and installed exiv2 in the normal way (make config ; ./configure ; make ; sudo make install) you should be fine with that. The option -o exifprint says the resulting output file is to be called exifprint (default is a.out).
If your project has lots of source files, you'll probably want to use make or XCode. If you want help with either, please let me know and I'll explain further.
Robin
RE: Help compiling exifprint - Added by Robin Mills about 12 years ago
Woops, I've just notice that you're using Eclipse. There will be a simple way to say "link libexiv2.a". I'm going to bed at the moment (it's almost 1am in California). If you're stuck, let me know and I'll look at in the morning for you.
Robin
RE: Help compiling exifprint - Added by Nathan Sullivan about 12 years ago
That worked perfectly. Thanks. That's some good stuff to know, finding basic information about things isn't always the easiest thing to do.