我目前正在开发一个介绍性 C++ 项目,使用 Eclipse Juno、CDT 和 Cygwin C++。我正在使用 MVC 架构,并且刚刚获得了可以运行可执行文件并查看一些结果的代码。当我构建应用程序时,编译器不会抛出任何错误;但是,当我通过 Eclipse 运行该应用程序时,该应用程序会重建并显示以下错误:
make: *** multiple target patterns. Stop. GasFinderTUI.d KyleGasStationFinder/Debug/src/View line 1 C/C++ Problem
这是该文件中的我的代码:
src/Controller/GasFinderController.d src/Controller/GasFinderController.o: \
../src/Controller/GasFinderController.cpp \
../src/Controller/GasFinderController.h \
C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/LocalGasStations.h \
C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/GasStation.h \
C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/GasPump.h \
C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/Utilities.h
../src/Controller/GasFinderController.h:
C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/LocalGasStations.h:
C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/GasStation.h:
C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/GasPump.h:
C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/Utilities.h:
我尝试过清理和重建,而不使用运行功能,并且应用程序干净地构建。我还在没有 Eclipse 的情况下运行了实际的 .exe 文件,并且应用程序按预期运行。尽管与 Eclipse 分开运行应用程序是一个可接受的替代方案,但我将在不久的将来用 C++ 编写几个应用程序,并且很高兴能够从 Eclipse 执行。这些应用程序也将使用 Eclipse 进行检查和评分,我确信我的导师也会喜欢这种便利。
我看过this question建议将 C:/更改为相对路径名或/cygwin/c/。我的其他 .d 文件以及包含路径都使用相对路径,这些文件不会造成任何问题。尽管我相信这两种解决方案都可以工作,但每次编译都会重新创建 .d 文件。我所做的所有更改都在每次构建时被覆盖。
Eclipse 和/或 Cygwin C++ 是否包含任何可能允许我防止将来发生这种复杂情况的设置?
最佳答案
我发现我可以在 Eclipse 中运行该项目,只要我在每次运行之前手动清理它。另外,如果我在每次构建之前手动清理它,构建就会成功。提交此作业后,我将考虑创建一个用于编译的自定义脚本。
关于makefile - 使 : *** multiple target patterns. 停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14514086/