gpt4 book ai didi

c++ - 如何在我的 C++ 项目中包含 *.cpp 文件?

转载 作者:行者123 更新时间:2023-11-30 01:13:26 24 4
gpt4 key购买 nike

我必须使用 CppUnit 库编写 UnitTest,但我几乎不需要帮助。我在我的测试类中包含了 mainfunction,但它不起作用。

Here is the ss from eclipse

最佳答案

我没有使用过 CppUnit,所以这可能是常规的,但一般来说,你永远不会 #include .cpp 文件。你确定你这样做是对的吗?

如果你是,你需要#include "mainfunction.cpp" ,因为 #include <> does not look in the current directory, only library include paths .

您对 .h 做对了, 所以我不明白你为什么把它改成 .cpp .

关于c++ - 如何在我的 C++ 项目中包含 *.cpp 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32117979/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com