Eclipse CDT 构建配置 - 使用 CPP 单元测试 DLL

发布于 2024-09-11 05:07:59 字数 225 浏览 1 评论 0原文

我正在使用 eclipse 在 C++ 中制作一个 DLL(并且可能在以后的某个时间制作一个 Linux 端口)。情况如下:我正在尝试进行两个单独的构建配置,一个将构建 DLL,另一个将构建可执行的 CppUnit 测试。目前我已经完成了所有 DLL 的构建,并且我可以创建一个单独的项目来测试 DLL;但是,我想知道是否有任何方法可以在一个项目中完成这一切。

对于此事的帮助将不胜感激!

谢谢, 克里斯

I'm making a DLL (and probably a Linux port at some later date) in C++ using eclipse. The situation is as follows: I am trying to make two separate build configurations, one that will build a DLL and one that will build an executable CppUnit test. Currently I have all of the DLL build working, and I can make a separate project to test the DLL with; however, I was wondering if there was any way to do this all in one project.

Help on this matter would be greatly appreciated!

Thanks,
Chris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

朦胧时间 2024-09-18 05:07:59

好吧,我找到了如何做到这一点,所以如果其他人偶然发现了这个...

如果您进入“项目->属性->C/C++ 构建->设置”,然后选择一种调试配置(或创建一个新配置)。转到“构建工件”选项卡,并将“工件类型”更改为“可执行文件”。

现在,为了避免将所有源代码编译到所有构建配置中(例如将 main() 构建到 DLL 中,这没有多大意义),请转到“Project->Properties->Properties”。 C/C++ 常规 -> 路径和符号”。选择您的构建配置并转到“源位置”选项卡。您可以在此处添加新的源文件夹/删除已存在的源文件夹。

Well, I found out how to do it, so if anyone else stumbles across this...

If you go into "Project->Properties->C/C++ Build->Settings", then select a debug configuration (or create a new one). Go to the "Build Artifact" tab, and change the "Artifact Type" to executable.

Now to avoid having all of your source code compiled into all Build Configurations (such as your main() being built into a DLL, which doesn't make much sense), go to "Project->Properties->C/C++ General->Paths and Symbols". Select your build configuration and go to the "Source Location" tab. Here you can add new source folders/remove source folders that already exist.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文