简体   繁体   English

由于忘记了源文件,在链接我自己的静态库时检测到未解析的符号

[英]Detect unresolved symbols when linking my own static library due to forgotten source files

I've had problems when building a large static library that sometimes I've forgotten to add certain source files to the project. 在构建大型静态库时遇到了问题,有时我忘记将某些源文件添加到项目中。 Since this is a static library there are no linker warnings until the end user, who is using a public API, is using a method that is calling one of these missing symbols. 由于这是一个静态库,因此在使用公共API的最终用户使用一种调用这些丢失符号之一的方法之前,不会有任何链接程序警告。 Is there any way to make sure all the "library local" symbols are resolved at linking time? 有什么方法可以确保在链接时解析所有“本地库”符号?

As mentioned by @PeteBecker in the comments, this is about testing. 正如@PeteBecker在评论中提到的,这是关于测试的。

Create an executable that uses the static library and as long as it uses all the features you will catch missing objects very quickly, during link. 创建一个使用静态库的可执行文件,只要它使用了所有功能,您就可以在链接期间快速捕获丢失的对象。

Make this executable test all the features and it doubles as your unit test facility as well. 使此可执行文件测试所有功能,它也可以兼作单元测试工具。

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

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