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

标签 c++ visual-studio linker linker-errors

最近 VS17 开始经常给我“增量链接器已停止工作”,我的意思是很多。我没有更新任何东西(操作系统或 VS)。它突然开始,没有明显的原因。大多数时候,我设法更改我的代码,以免发生这种情况。

这是我当前的代码(它应该对一个字符串进行异或并返回十六进制转义字符串):

__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;
}

有任何修补程序吗?或者也许您知道我的代码中是什么导致了这个? (是的,我正在删除返回的 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

关于c++ - Microsoft 增量链接器已停止工作 VS17,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49588552/

相关文章:

c++ - 为什么 gcc 不报告跟随重复符号的错误?

c++ - 使用标准布局类型与其他语言进行通信

c++ - cpp-netlib 如何使此类示例通过 TCP 返回(删除 http header )?

c++ - 平衡括号 - 堆栈未被识别为空

c# - 基本的 while 循环 c#

python - 在编码 Visual Studio + PTVS 时是否可以使用基于远程 vagrant 的 python 解释器

c++ - 为什么这个功能进入范围?

c++ - 递归如何获取以前的值?

编译简单的 hello world ZeroMQ C 示例,编译标志?

c++ - 静态变量初始化顺序