C++ IDE 从 VS 6 迁移到 VS 2013

C++ IDE migration from VS 6 to VS 2013

一个C++项目可以被VS6编译而没有错误和警告。 使用 VS 2013 Prof.,会出现链接器问题。他们提供了一种模式,即 std::basic_string.

代码是2007年写的,不是我写的

被构造函数引用:

vrun.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: char const * __thiscall std::basic_string,class std::allocator >::c_str(void)const " (__imp_?c_str@?$basic_s tring@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) referenced in fun ction "public: __thiscall VTrs::VTrs(class VMessageContext &)" (?? 0VDMTrs@@QAE@AAVVDMMessageHandlerContext@@@Z)

在vrun.cpp中:

VTrs::VTrs(VMessageContext& handler_):
Inherited(RXS::rName().c_str()),
_handler(handler_)
{
}

(c_str -> const char* c_str() const; --- C98 风格 --- C11 尚未在项目中应用)

在vrun.h中:

VTrs(VMessageContext&);

操作员引用:

vrun.obj : error LNK2019: unresolved external symbol "__declspec(dllimport)
 public: int __thiscall std::basic_string<char,struct std::char_traits<char>,cl
ass std::allocator<char> >::compare(char const *)const " (__imp_?compare@?$basi
c_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEHPBD@Z) referenced in
 function "bool __cdecl std::operator==<char,struct std::char_traits<char>,clas
s std::allocator<char> >(class std::basic_string<char,struct std::char_traits<c
har>,class std::allocator<char> > const &,char const *)" (??$?8DU?$char_traits@
D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$a
llocator@D@2@@0@PBD@Z)

就解释而言,指的是标准运算符。 (没有对引用字符串的 == 进行运算符重载)

顺便说一句,代码本身不包含“std::basic_string”。 阅读了相应的 msdn 文章,但此问题尚未解决。

'Usual' 问题,例如 "C" 修改器修改已经考虑到另一个代码。

任何提示如何处理?

编辑:第一次使用 Visual Studio 2013 打开项目时,显示了一种转换对话框。我同意了,但它影响了 VC++ 目录。将带有 ClearCase 的项目文件与以前的版本进行比较时可见。 UndoCheckout(通过 ClearCase)应用了旧状态。现在可以了。

您的链接器需要从相关的 lib 文件中获取更新的 MSVC std 库,它应该在您迁移项目时选择它。查看 Project Properties->Configuration Properties->Linker->Input 并确保 "Ignore All Default Libraries" 设置为 No

Visual Studio2013 第一次打开项目时,出现了一种转换对话框。我同意了,但它影响了 VC++ 目录。将带有 ClearCase 的项目文件与以前的版本进行比较时可见。 UndoCheckout(通过 ClearCase)应用了旧状态。现在可以了。