gpt4 book ai didi

c++ - 无法在eclipse中编译带有输入和输出的c++程序

转载 作者:行者123 更新时间:2023-11-28 05:24:17 25 4
gpt4 key购买 nike

每当我尝试构建涉及 I/O 的 C++ 程序时,我都会在 Eclipse 中遇到错误。

02:19:02 **** Incremental Build of configuration Debug for project SecondProject ****
make all
Building target: SecondProject
Invoking: GCC C++ Linker
g++ -o "SecondProject"
g++: fatal error: no input files
makefile:45: recipe for target 'SecondProject' failed
compilation terminated.
make: *** [SecondProject] Error 1

对于不需要用户输入的其他 C++ 程序,它编译得很好。

但是,当我使用命令行时,我可以毫无问题地进行编译。为什么会这样?有解决办法吗?

最佳答案

编译器正在尝试编译没有源文件的 SecondProject。这就是您观察到这一点的原因:

g++  -o "SecondProject"   
g++: fatal error: no input files

疑难解答

中验证您的项目属性

Properties > C/C++ General > Paths and Symbols

检查您的 Source LocationInclude 路径是否设置正确。如果您的路径正确,您应该会在再次构建时看到类似的内容:

g++  -o "SecondProject"   ./<your src folder>/<something>.o ...

否则,创建一个全新的 C/C++ 项目并再次添加源代码。

关于c++ - 无法在eclipse中编译带有输入和输出的c++程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40859954/

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