【问题标题】:Debug dll file with the dll source code C++使用 dll 源代码 C++ 调试 dll 文件
【发布时间】:2020-03-06 19:23:46
【问题描述】:

我在带有QMake 构建系统的MS-Windows 中使用带有MSVC2017 的QtCreator IDE。为了总结我的调试问题,我举个例子:
我使用以下文件创建了一个名为 library 的项目:
library.h

#ifndef A
#define A

#include <stdio.h>

#ifdef __cplusplus
extern "C"
#endif
__declspec(dllexport) void some_function(void);

#endif

library.c

#include "library.h"
void some_function(void)
{
    printf("We are in the %s::%d\n", __FUNCTION__, __LINE__);
}

我从我的library 项目中创建了.dll.lib。我在另一个项目中使用过,当我尝试调试时,我可以看到 .dll 函数源代码:
ma​​in.cpp

#include "library.h"

int main (void)
{
    some_function(); /* Put the break point right here,
                      * And i could see the source code
                      * while debugging.
                      */
}

在上面的例子中一切都是正确的,调试时不让我看到我的.dll源代码有什么问题?

【问题讨论】:

  • “为了总结我的调试问题,我给你举个例子” ...“在上面的例子中一切都是正确的” 那么,问题是什么?
  • @IgorTandetnik "调试时不让我看到我的 .dll 源代码会有什么问题?",在另一个项目中我看不到 dll 源代码调试时的代码,我知道什么是问题?
  • 您在问题中没有提到这一点。很可能,您没有该 DLL 的调试信息(.pdb 文件)。

标签: c++ c debugging visual-c++ dll


【解决方案1】:

我只是将库文件扩展名从 .c 更改为 .cpp 并在 QtCreator 中同时打开两个项目。

【讨论】:

    猜你喜欢
    • 2015-11-13
    • 2012-06-21
    • 1970-01-01
    • 1970-01-01
    • 2011-09-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-21
    相关资源
    最近更新 更多