Microsoft 增量链接器已停止工作 VS17

Microsoft Incremental Linker has stopped working VS17

最近 VS17 开始给我 "Incremental Linker has stopped working" 很多,我的意思是很多。我没有更新任何东西(OS 或 VS)。它突然开始,没有明显的原因。大多数时候我设法更改我的代码,所以它不会发生。

这是我当前的代码(它应该对字符串和 return 十六进制转义字符串进行异或):

__inline char* EncryptString(const char* String, const char* Key)
{
    char* szEncrypted = new char[lstrlenA(String) + 1];
    memcpy(szEncrypted, String, lstrlenA(String));

    for (int32_t i = 0; i < lstrlenA(String); ++i)
        szEncrypted[i] = String[i] ^ Key[i % (sizeof(Key) / sizeof(char))];

    std::stringstream lpStream;

    for (int32_t i = 0; i < lstrlenA(szEncrypted); ++i)
    {
        char cCharInd       = szEncrypted[i];
        int32_t nCharNum    = static_cast<int32_t>(cCharInd);

        lpStream << "\x" << 2;
    }

    std::string sHexEscaped = lpStream.str();
    lpStream.clear();

    delete[] szEncrypted;

    char* szReturn = new char[sHexEscaped.length() + 1];
    memcpy(szReturn, sHexEscaped.c_str(), sHexEscaped.length() + 1);

    return szReturn;
}

有补丁吗?或者,也许您知道我的代码中是什么原因造成的? (是的,我正在删除 returned char*。并不是说它与链接器错误有任何关系,但不要因此而欺负我)。 或者有其他人在 VS17 中遇到过这种情况吗?

Thanks mate, it works. You can make it an answer if you want and I'll accept it

看来这可能是 VS2017 中的某种错误。这种链接器错误发生在我身上,即使代码相对较小,例如更改 std::cout 的输出值这样简单的事情也会触发它。解决方案似乎是对代码进行 运行 Clean 操作,可以在

中找到

Solution Explorer -> [右击项目名称] -> Clean