Jump to content
  • Advertisement
Sign in to follow this  
jollyjeffers

LNK2001's in "Release" build only..

This topic is 4841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Afternoon all, I've somehow managed to break my program such that it will no longer compile in the "release" profile, but work absolutely fine in the "debug" profile. I'm using VC++2003. It's far from the first time I've had to do battle with LNK2001's - but this time I'm thoroughly confused, and more importantly don't really know how to solve it. Any help would be really appreciated!
CGameError.obj : error LNK2001: unresolved external symbol "__int64 std::_Fpz" (?_Fpz@std@@3_JA)
CGameError.obj : error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB)
CGameError.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ)
CGameError.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ)
CGameError.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::locale::facet::_Register(void)" (?_Register@facet@locale@std@@QAEXXZ)
CGameError.obj : error LNK2001: unresolved external symbol "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z)
CGameError.obj : error LNK2001: unresolved external symbol "public: void __thiscall std::ios_base::_Addstd(void)" (?_Addstd@ios_base@std@@QAEXXZ)
CGameError.obj : error LNK2001: unresolved external symbol __Towlower
CGameError.obj : error LNK2001: unresolved external symbol __Towupper
CGameError.obj : error LNK2001: unresolved external symbol __Getwctype
CGameError.obj : error LNK2001: unresolved external symbol __Getwctypes
CLogFile.obj : error LNK2001: unresolved external symbol "struct _iobuf * __cdecl std::_Fiopen(char const *,int,int)" (?_Fiopen@std@@YAPAU_iobuf@@PBDHH@Z)

My normal routine for this would be to look up the functions it moaning about and find out what lib file they need to be linked against and then add that to the project properties as appropriate... Odd things I don't get:
  1. They all appear to be internal/implementation functions due to being prefixed with "_" or "__". I know it's likely that the code I call is, as part of the implementation, calling these - but it doesn't make much sense to me that they're exposing themselves.
  2. I've tried looking up some of the functions in all the usual places and they don't even seem to exist. I can't even find them in any header files installed on my machine ([oh]). Having no documentation only adds to the fun.
  3. The linker errors all refer to CGameError.obj - which is a very simple wrapper class for exceptions - it doesn't really do anything beyond store whatever was passed to the constructor. There are no errors/warnings with this class, and apart from (recently) changing all the std::string to std::wstring it hasn't been touched.
  4. The library search order seems to be a bit off to me, but I don't get how to sort it out. I've seen references to some similarly named functions in the docs (towupper instead of __Towupper) linking to libcp.lib and libc.lib. It seems that the debug build pulls libcpd.lib from the VC7 installdir, whereas the release build pulls lpcp.lib from the PSDK installdir. But I don't know how to change this as those lib's are pulled in by compiler switches (/ML and /MLd iirc)
Can anyone give me any ideas for this? I'm gonna go bald due to tearing my own hair out for this one [sad] Cheers, Jack

Share this post


Link to post
Share on other sites
Advertisement
I assume you already tried doing a clean build?

Another possibility is that maybe you have an inconsistent UNICODE define in your project. I think some of those errors can happen if UNICODE gets #undefed or #define in the middle of a translation unit.

Share this post


Link to post
Share on other sites
Thanks for the quick reply [smile]

Quote:
Original post by SiCrane
I assume you already tried doing a clean build?

Yup, clean build, rebuild all.. no change [headshake]

Quote:
Original post by SiCrane
Another possibility is that maybe you have an inconsistent UNICODE define in your project. I think some of those errors can happen if UNICODE gets #undefed or #define in the middle of a translation unit.

I'll look into that... but currently the UNICODE and _UNICODE symbols are defined at the project-properties level (so should be global) rather than in individual files. I'll see if putting a #define in after the system #include's does anything. My guess is it'll probably explode though.

Thanks,
Jack

Share this post


Link to post
Share on other sites
Just a quick follow up for anyone who was/is reading this...

Seems that, after much trial-n-error I needed to switch the release profile over to the multi-threaded runtime. Go figure why changing from ANSI to Unicode required that, but it works now [rolleyes]

Cheers,
Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!