1

I'm trying to compile a project (swac-record) that relies on qt, portaudio and FLAC. I'm on Mac OS X.

This is what I've got so far:

qmake swac-record-0.4   // This creates a Makefile at the same level as the project and .pro and .qrc files inside the project.
qmake swac-record-0.4/swac-record.pro   // not sure what this does exactly
make    // will compile the whole project

...but then compilation fails because some symbols cannot be resolved.

Undefined symbols for architecture x86_64:
  "_FLAC__StreamDecoderErrorStatusString", referenced from:
      DecoderFlac::error_callback(FLAC__StreamDecoderErrorStatus) in codec_flac.o
  "_FLAC__StreamDecoderInitStatusString", referenced from:
      DecoderFlac::decode(Channel&) in codec_flac.o
  "_FLAC__metadata_object_new", referenced from:
      EncoderFlac::setTag(Tag const&) in codec_flac.o
  "_FLAC__metadata_object_vorbiscomment_append_comment", referenced from:
      EncoderFlac::setTag(Tag const&) in codec_flac.o
  "_FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair", referenced from:
      EncoderFlac::setTag(Tag const&) in codec_flac.o

I don't really have experience with C++. Anyway, my understanding of it is that compilation fails because it cannot find the FLAC library.

The project's website says it uses Flac++ (libflac++-dev) and it is referenced like so in the code:

#include <FLAC++/decoder.h>
#include <FLAC++/encoder.h>

My questions then become:

  • How can I install libflac++? (Is it not included in flac already installed on the Mac?)
  • How can I link to libflac++?

I haven't had much luck researching this question (the closest I got is this question but I'm not using Xcode.)


EDIT: as ddriver's advised, I've built libflac myself and added it to the project.

Building libflac: I got the source code and compiled it using ./configure && make && make check && make install. As far as I can tell it went fine:

pkg-config --list-all | grep FLAC++ 
ls /usr/local/lib  | grep FLAC

flac++               FLAC++ - Free Lossless Audio Codec Library (C++ API)
libFLAC++.6.dylib
libFLAC++.a
libFLAC++.dylib
libFLAC++.la

Adding it to the project: I did so by editing swac-record.pro and adding the library like so (this thread helped):

INCLUDEPATH += /usr/local/lib
LIBS += -L"/usr/local/lib" -lFLAC++

However, I'm still getting the same Undefined symbols error. What did I miss?

Community
  • 1
  • 1
Fabien Snauwaert
  • 4,995
  • 5
  • 52
  • 70
  • You will probably have to build libflac yourself, and then simply add the output library to your project with the Creator "Add library" wizard. – dtech Feb 24 '15 at 10:34
  • Do you build with the same compiler version? – dtech Feb 25 '15 at 10:16
  • I'm not certain I understand the question. Do you mean if I use the same compiler for the FLAC lib and the swac-record project? The Makefile from FLAC reads `Makefile.in generated by automake 1.14.1 from Makefile.am.` while the one from swac-record reads `Generated by qmake (2.01a) (Qt 4.8.6) on: Wed Feb 25 16:30:39 2015`. What should I try? – Fabien Snauwaert Feb 25 '15 at 15:38
  • I mean whether flaclib and your project are being compiled by the same compiler version. Sometimes it is possible to use a library compiled with a different minor version as long as the major version is the same, but it is best to just compile everything with the same compiler version to ensure full binary compatibility. I've been getting such messages when trying to use a library compiled with a different compiler than the one used for the project. – dtech Feb 25 '15 at 17:05

0 Answers0