Linking error LNK2001 - "__declspec(dllimport) private: void __thiscall std::basic_string<char,struc

S

sharmadeep1980

Hi All,

I am facing a very unique problem while compling my project in
"Release" build.
The project is building in DEBUG mode but giving linking error on
Release build.
Here is the error:
Creating library Release/fnimqcmd.lib and object
Release/fnimqcmd.exp
CoIMQCmd.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) private: void __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Tidy(unsigned short)"
(__imp_?_Tidy@?$basic_string@DU?$char_
traits@D@std@@V?$allocator@D@2@@std@@AAEXG@Z)
CoIMQCmd.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) private: unsigned short __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Grow(unsigned int,unsigned short)"
(__imp_?_Grow@?
$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEGIG@Z)
Release/fnimqcmd.dll : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

My project is a MFC extension DLL using "Use MFC in shared DLL". I
started running into this problem when I have used STL::vector in my
project. Somehow I feel that this is the cause of the problem but not
able to locate the reasons.

Furthermore, I am able to compile the project in "Debug"
confiiguration. In "Release" configuration if we turn off the
optimization i.e project settings->Optimization-> Disable(Debug) we are
able to link it successfully.

Following are some more project settings under C/C++ tab->Code
generation:-

Processor->Blend*
Use run-time library-> Multithreaded DLL(/MD)
Calling Conventions -> __cdecl*

My product build is being stucked due to this project so an early
response would be highly appreciated.

Thanks in advance.

Regards
Deepak
 
M

Murali Krishna

Hi All,

I am facing a very unique problem while compling my project in
"Release" build.
The project is building in DEBUG mode but giving linking error on
Release build.
Here is the error:
Creating library Release/fnimqcmd.lib and object
Release/fnimqcmd.exp
CoIMQCmd.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) private: void __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Tidy(unsigned short)"
(__imp_?_Tidy@?$basic_string@DU?$char_
traits@D@std@@V?$allocator@D@2@@std@@AAEXG@Z)
CoIMQCmd.obj : error LNK2001: unresolved external symbol
"__declspec(dllimport) private: unsigned short __thiscall
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >::_Grow(unsigned int,unsigned short)"
(__imp_?_Grow@?
$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEGIG@Z)
Release/fnimqcmd.dll : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

My project is a MFC extension DLL using "Use MFC in shared DLL". I
started running into this problem when I have used STL::vector in my
project. Somehow I feel that this is the cause of the problem but not
able to locate the reasons.

Furthermore, I am able to compile the project in "Debug"
confiiguration. In "Release" configuration if we turn off the
optimization i.e project settings->Optimization-> Disable(Debug) we are
able to link it successfully.

Following are some more project settings under C/C++ tab->Code
generation:-

Processor->Blend*
Use run-time library-> Multithreaded DLL(/MD)
Calling Conventions -> __cdecl*

My product build is being stucked due to this project so an early
response would be highly appreciated.

Thanks in advance.

Regards
Deepak

Hi Deepak, this is not an MFC Group. You can get better answers in

microsoft.public.vc.mfc (you have already posted)

how ever, settings for debug mode and release mode are different.

you would have added a .lib to link in the settings in debug mode.

add the same .lib file in the settings of release mode (in the link
tab).

Plz do not post queries regarding OS, IDEs issues.

-- Murali Krishna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top