[flac-dev] Trying to link against libFLAC_static.lib (windows)

Glenn McCord glenn.mccord at gmail.com
Sun Mar 25 20:37:18 PDT 2012


On Mon, Mar 26, 2012 at 1:32 PM, JonY <jon_y at users.sourceforge.net> wrote:
> On 3/26/2012 06:52, Glenn McCord wrote:
>>>
>>> Did you compile the dll earlier? If so, you can try cleaning the project
>>> and rebuilding.
>>
>> I've compiled the .dll earlier, but they've now all been deleted. They
>> would have been built when I built the entire solution (and thus all
>> the projects). I've subsequently deleted them and just built the
>> libFLAC_static.lib
>>
>> I've previously installed the "FLAC for windows with installer" from
>> the flac website, but I've since deleted that too. There are no flac
>> libraries anywhere on my machine now except for that single
>> libFLAC_static.lib that has been built.
>>
>
> I'm not very familiar with MSVC, but I was suggesting cleaning out all
> the temporary files too, not just the dll/lib end targets.

I've found the issue. I've only just realised that FLAC__NO_DLL is
also required by the application using flac, not just the flac project
itself.

I've subsequently just added #define FLAC__NO_DLL to my two header
files that include flac headers and now everything is fine.

Thanks for all the help.

Glenn

>
>>>
>>> If not, you'd need to look into the headers, check where those problem
>>> functions are defined. Finally, you'll need to trace back any macros
>>> that might be potentially using __declspec(dllimport).
>>
>> Just to be sure, I went to export.h and exlicitly defined FLAC_API and
>> commented out the lines
>>
>> #ifdef FLAC_API_EXPORTS
>> #define       FLAC_API        _declspec(dllexport)
>> #else
>> #define FLAC_API      _declspec(dllimport)
>>
>> I've so cleaned and rebuilt all my project files but still get the errors:
>>
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol
>> __imp__FLAC__stream_decoder_process_until_end_of_metadata referenced
>> in function "protected: int __thiscall
>> CFlacDecoder::CreateDecoder(void)"
>> (?CreateDecoder at CFlacDecoder@@IAEHXZ)
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol __imp__FLAC__stream_decoder_init_file referenced in
>> function "protected: int __thiscall CFlacDecoder::CreateDecoder(void)"
>> (?CreateDecoder at CFlacDecoder@@IAEHXZ)
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol __imp__FLAC__stream_decoder_init_ogg_file referenced
>> in function "protected: int __thiscall
>> CFlacDecoder::CreateDecoder(void)"
>> (?CreateDecoder at CFlacDecoder@@IAEHXZ)
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol __imp__FLAC__stream_decoder_new referenced in function
>> "protected: int __thiscall CFlacDecoder::CreateDecoder(void)"
>> (?CreateDecoder at CFlacDecoder@@IAEHXZ)
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2001: unresolved
>> external symbol __imp__FLAC__StreamDecoderStateString
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol __imp__FLAC__stream_decoder_get_state referenced in
>> function "int __cdecl die_s_(char const *,struct FLAC__StreamDecoder
>> const *)" (?die_s_@@YAHPBDPBUFLAC__StreamDecoder@@@Z)
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2001: unresolved
>> external symbol __imp__FLAC__StreamDecoderErrorStatusString
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol __imp__FLAC__stream_decoder_delete referenced in
>> function "public: virtual __thiscall
>> CFlacDecoder::~CFlacDecoder(void)" (??1CFlacDecoder@@UAE at XZ)
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol __imp__FLAC__stream_decoder_flush referenced in
>> function "public: int __thiscall CFlacDecoder::Seek(unsigned int)"
>> (?Seek at CFlacDecoder@@QAEHI at Z)
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol __imp__FLAC__stream_decoder_seek_absolute referenced
>> in function "public: int __thiscall CFlacDecoder::Seek(unsigned int)"
>> (?Seek at CFlacDecoder@@QAEHI at Z)
>> 11>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2019: unresolved
>> external symbol __imp__FLAC__stream_decoder_process_single referenced
>> in function "public: int __thiscall CFlacDecoder::DecodeFrame(void)"
>> (?DecodeFrame at CFlacDecoder@@QAEHXZ)
>> 11>.\Debug/ScratchLIVE.exe : fatal error LNK1120: 11 unresolved externals
>>
>> Could there be some setting that I've got incorrect or incompatible
>> between the FLAC project and the project that is using it?
>>
>
> From the looks of the above macro, you should #define FLAC_API to
> nothing. Perhaps you could try searching deeper if FLAC_API was doubly
> defined elsewhere.
>
>
>
> _______________________________________________
> flac-dev mailing list
> flac-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/flac-dev
>


More information about the flac-dev mailing list