Glenn McCord
2012-Mar-23 05:59 UTC
[flac-dev] Trying to link against libFLAC_static.lib (windows)
Hi. I'm trying to get a project linking to libFLAC_static.lib but I get linker errors such as the following. 6>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) 6>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) 6>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) 6>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) 6>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2001: unresolved external symbol __imp__FLAC__StreamDecoderStateString 6>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) 6>AudioDecoder.lib(CFlacDecoder.obj) : error LNK2001: unresolved external symbol __imp__FLAC__StreamDecoderErrorStatusString 6>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) 6>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) 6>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) 6>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) 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) 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? Thanks Glenn
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. 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). -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 196 bytes Desc: OpenPGP digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20120323/ceb0d5d8/attachment.pgp
Glenn McCord
2012-Mar-25 22:52 UTC
[flac-dev] Trying to link against libFLAC_static.lib (windows)
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 >