sách gpt4 ăn đã đi

c++ - Visual Studio C++ "Multithreaded Debug DLL"与 "Multithreaded DLL"

In lại Tác giả: Walker 123 更新时间:2023-11-30 04:30:02 26 4
mua khóa gpt4 giày nike

我的一个项目只适用于调试 DLL,而不适用于非调试 DLL。

  1. 在 Debug DLL 设置下发布项目有哪些注意事项?例如,是否丢失了某些优化?

  2. 如何通过将调试版本设置为非调试 DLL 来调试此项目?我试过这样做,甚至将 _Debug 更改为 NDEBUG,但无论哪种方式都会给我同样的错误:

    未解析的外部符号 imp_CrtDbgReportW 在函数中引用“public: class std::basic_string,class std::allocator > const & __thiscall std::_Vector_const_iterator,class std::allocator >,class std::分配器,类 std::allocator >> >>::operator*(void)const "(??D?$_Vector_const_iterator@V?$_Vector_val@V?$basic_string@DU?$char_traits@D@std@@ V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@ std@@@std@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@XZ)

所以我不知道如何调试这个项目来解决只在非调试编译器设置下发生的错误。

câu trả lời hay nhất

看起来您可能正在构建的发布配置中定义 _DEBUG,或者您直接调用 _CrtDbgReport() 而没有将其包围在 #ifdef _DEBUG 中。

http://msdn.microsoft.com/en-us/library/8hyw4sy7%28v=vs.80%29.aspx

Generates a report with a debugging message and sends the report to three possible destinations (debug version only).

此函数只应在调试构建中调用...

在回答您的其他问题时,发布调试版本通常不是一个选项,因为您还必须将 MS 调试运行时与您的二进制文件一起发送,而这不会出现在您与 Microsoft 的服务契约(Contract)中。此外,该构建将没有优化,并且可能比您的发布构建慢一个数量级......

您可以使用以下代码重现此错误,它将在发布和 Debug模式下编译,但在 Release模式下会产生类似于您看到的链接器错误:

#define _DEBUG

#include "windows.h"
#include

int _tmain(int argc, _TCHAR* argv[])
{
_CrtDbgReportW(_CRT_ASSERT, NULL, NULL, L"some module", NULL);
trả về 0;
}

关于c++ - Visual Studio C++ "Multithreaded Debug DLL"与 "Multithreaded DLL",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8977402/

26 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress