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

我在带有MSVC2017构建系统的MS-Windows中将QtCreator IDE与QMake一起使用。为了总结调试问题,我举一个例子:
我使用以下文件创建一个名为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__);
}

然后我从.dll项目中分别制作了.liblibrary。我在另一个项目中使用过,而在尝试调试时,我可以看到.dll函数的源代码:
main.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源代码可能有问题吗?

chen123321bin 回答:使用dll源代码C ++调试dll文件

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

本文链接:https://www.f2er.com/3126480.html

大家都在问