Nikos Chantziaras
2013-May-19 08:53 UTC
[flac-dev] FLAC won't allow project to build due to assert.h
I was looking into adding support for FLAC in my audio library, but there's a problem. Simply adding the output of: pkg-config flac --cflags to the compiler flags so that FLAC's headers can be found will break my build with errors like: error: 'assert' was not declared in this scope The problem is that /usr/include/FLAC has an "assert.h" header. In my C++ project, I have: #include <cassert> The cassert header (part of the standard C++ library) will internally include assert.h. But it ends up including the one from FLAC. I'm stuck. What do I do?
Erik de Castro Lopo
2013-May-19 13:59 UTC
[flac-dev] FLAC won't allow project to build due to assert.h
Nikos Chantziaras wrote:> I was looking into adding support for FLAC in my audio library, but > there's a problem. Simply adding the output of: > > pkg-config flac --cflags > > to the compiler flags so that FLAC's headers can be found will break my > build with errors like: > > error: 'assert' was not declared in this scope > > The problem is that /usr/include/FLAC has an "assert.h" header. In my > C++ project, I have: > > #include <cassert> > > The cassert header (part of the standard C++ library) will internally > include assert.h. But it ends up including the one from FLAC. > > I'm stuck. What do I do?First of all, this is fixed in the next release. Secondly, what I do for libsndfile with the current release is to remove the FLAC component of the include path provided by pkc-config and then include flac headers as <FLAC/headher.h> HTH, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Nikos Chantziaras
2013-May-19 19:45 UTC
[flac-dev] FLAC won't allow project to build due to assert.h
On 19/05/13 16:59, Erik de Castro Lopo wrote:> Nikos Chantziaras wrote: > >> [...] adding the output of: >> >> pkg-config flac --cflags >> >> to the compiler flags [...] will break my build with errors like: >> >> error: 'assert' was not declared in this scope >> >> The problem is that /usr/include/FLAC has an "assert.h" header. >> [...] > > First of all, this is fixed in the next release. > > Secondly, what I do for libsndfile with the current release is to remove > the FLAC component of the include path provided by pkc-config and then > include flac headers as <FLAC/headher.h>Yeah, that works. I didn't think this is the correct thing to do, since the FLAC headers might be installed somewhere else (perhaps with a version suffix.) But it seems this is actually what everybody does anyway, so I'll go with it. Thanks :-)