# LNK2001's in "Release" build only..

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

## 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 "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 on other sites
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 on other sites
Thanks for the quick reply [smile]

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

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

Quote:
 Original post by SiCraneAnother 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 on other sites

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

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 33
• 16
• 11
• 10
• ### Forum Statistics

• Total Topics
634123
• Total Posts
3015629
×