最近 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/