简体   繁体   English

为什么在C中使用外部库时eclipse没有调试?

[英]Why eclipse is not debugging when using external library in C?

First of all, I'm a begginer in C programming. 首先,我是C编程的初学者。 I have been looking for a solution for a long time but I don't know what's going on with mi code or with Eclipse configuration. 我一直在寻找解决方案,但我不知道mi代码或Eclipse配置会发生什么。 Basically, the problem occurs when I insert in the code a function from a external library. 基本上,当我从代码中插入外部库中的函数时,会出现问题。 For some reason, eclipse is not able to debugg the code. 出于某种原因,eclipse无法调试代码。

Let me explain that with a simple example: 让我用一个简单的例子解释一下:

Works incorrectly: 工作不正确:

int main(void) {

    char        version[32];

    puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */

    En2version(version);

    printf("Version %s \n", version);

    return 0;

}

Works correctly: 工作正常:

int main(void) {

    char        version[32];

    puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */

    printf("Version %s \n", version);

    return 0;

}

En2version() is the function took from the external library, and just eliminating it from the code it makes it work correctly. En2version()是从外部库中获取的函数,只是从代码中消除它使它正常工作。

I think the library is correctly linked to the project (there is no error when .lib is linked). 我认为库正确链接到项目(链接.lib时没有错误)。 Could you help me with some insight about what is happening? 你能帮助我了解一下发生了什么吗?

Thank you all. 谢谢你们。

I don't see your #include 我没有看到你的#include

Whatever your are using, you need debugging symbols 无论您使用什么,都需要调试符号

  • either using the Program Database way if you have a .pdb 如果您有.pdb,请使用程序数据库方式
  • either using the Embedded Symbols way if you have a no .pdb 如果您没有.pdb,请使用嵌入式符号方式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM