简体   繁体   English

如何在Ubuntu中使用Eclipse CDT调试C ++静态库?

[英]How to debug a C++ static library using Eclipse CDT in Ubuntu?

I am using Eclicpse to develop a static library made of functions that I use often. 我正在使用Eclicpse开发由我经常使用的功能组成的静态库。 I have done so creating a "C++ -> Static Library" project in my workspace. 我已经在我的工作区中创建了一个“ C ++->静态库”项目。

In the same workspace I have created an other project "Test" that I use to test that my functions work as expected. 在同一工作区中,我创建了另一个项目“测试”,用于测试我的功能是否按预期工作。 I have linked the libraries to this project and I am able to use the library in my code. 我已将库链接到该项目,并且可以在代码中使用该库。

One of my functions has some problems and I would like to debug it. 我的功能之一存在一些问题,我想对其进行调试。 If I run "Debug" in Eclipse on my test project I can't however "step in" the function that is causing problems. 如果我在测试项目上的Eclipse中运行“调试”,则无法“介入”导致问题的功能。

How can I achieve this? 我该如何实现? Alternatively which is a good way by which I can test and debug my static libraries in Eclipse? 或者,这是在Eclipse中测试和调试静态库的好方法吗?

You need to compile the static libraries with debug information. 您需要使用调试信息来编译静态库。

Go to [Properties] -> [C/C++ Build] -> [Settings] -> [GCC C++ Application] -> [Debugging] and turn on debugging and make sure the build is set to debug configuration. 转到[属性]-> [C / C ++构建]-> [设置]-> [GCC C ++应用程序]-> [调试],然后打开调试,并确保将构建设置为调试配置。

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

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