Eclipse CDT 构建配置 - 使用 CPP 单元测试 DLL
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我找到了如何做到这一点,所以如果其他人偶然发现了这个...
如果您进入“项目->属性->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.