gpt4 book ai didi

c++ - 使用dll源代码C++调试dll文件

转载 作者:行者123 更新时间:2023-11-30 16:10:48 35 4
gpt4 key购买 nike

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

#ifndef A
#define A

#include <stdio.h>

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

#endif

库.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 源代码,可能会出现什么问题?

最佳答案

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

关于c++ - 使用dll源代码C++调试dll文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58795729/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com