【发布时间】:2017-09-28 07:24:25
【问题描述】:
我在 code::blocks IDE 中制作了这个简单的 c++ 程序:
#include <iostream>
#include "funct.cpp"
using namespace std;
int main()
{
float a, b;
cout << "enter a : ";
cin >> a;
cout << "enter b : ";
cin >> b;
cout << "\n\nThe result is: " << funct(a, b) << "\n";
return 0;
}
还有这个功能:
#include <iostream>
using namespace std;
float funct(float x, float y)
{
float z;
z=x/y;
return z;
}
当我通过创建新的空文件在 IDE 中创建函数并尝试构建程序时,它返回此错误:
但是当我通过文本编辑器手动创建相同的函数文件并将其放在项目的同一文件夹中时,它可以正常工作并且编译器可以毫无错误地构建它。
这是因为我做错了什么还是 IDE 中的错误?
你能帮我解决这个问题吗?
提前致谢。
【问题讨论】:
-
从不#include .cpp 文件。
-
那我该怎么办?
-
compiler 错误怎么可能是 IDE 中的错误?
-
对不起我还是个菜鸟
标签: c++ ide codeblocks build-error