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

Glenn McCord glenn.mccord at gmail.com
Sun Mar 25 15:52:35 PDT 2012


On Fri, Mar 23, 2012 at 9:45 PM, JonY <jon_y at users.sourceforge.net> wrote:
> On 3/23/2012 13:59, Glenn McCord wrote:
>> Hi. I'm trying to get a project linking to libFLAC_static.lib but I
>> get linker errors such as the following.
>>
>> The __imp__ prefix seems to imply that some kind of .dll usage is
>> happening, which it shouldn't.
>>
>> All I need is the C lib, so I just build libFLAC_static from within
>> VS2010 (I've converted the VS2005 project)
>>
>> I've then linked to that library by setting the linker settings
>> General-> "Additional Library Dependencies" and Input-> "Additional
>> Dependencies" appropriately.
>>
>> Both the main app and the flac libs are build using the "runtime
>> library" Multi-Threaded /MT (or /MTd for debug mode)
>>
>
> That is the MSVCR* library settings.
>
>> The flac project is using the preprocessor definitions:
>>
>> WIN32
>> NDEBUG
>> _LIB
>> FLAC__HAS_OGG
>> FLAC__CPU_IA32
>> FLAC__HAS_NASM
>> FLAC__USE_3DNOW
>> VERSION="1.2.0"
>> FLAC__NO_DLL
>>
>> I'm not sure what else to try at this stage. I've reached the point
>> where I start going in circles and accessing the same internet search
>> results. Has anyone got any suggestions?
>>
>
> 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.

>
> 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?

>
>
> _______________________________________________
> 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