0
我写C++天气报告程序和我收到以下错误失踪分离++蚀GCC错误
/*
Description Resource Path Location Type
make: *** missing separator. Stop. subdir.mk /weather/Debug/src line 21 C/C++ Problem
*/
代码在Visual Studio中正常工作,但它并没有在Eclipse CDT的工作( gcc编译器)。
这里是图像:(http://prntscr.com/5nnpap)
这里是代码:
/*
* aks.cpp
*
* Created on: 31-Dec-2014
* Author: student
*/
#include<iostream>
#include<stdio.h>
using namespace std;
class weather_report
{
public:
int day, hightemp, lowtemp, amtrain, amtsnow;
weather_report()
{
day = 99;
hightemp = 999;
lowtemp = -999;
amtrain = 0;
amtsnow = 0;
}
void display()
{
cout << "\n " << day;
cout << "\t\t" << hightemp;
cout << "\t" << lowtemp;
cout << "\t" << amtrain;
cout << "\t" << amtsnow;
}
void Accept()
{
cout << "\n enter day ";
cin >> day;
cout << "\n enater hightemp ";
cin >> hightemp;
cout << "\n enter lowtemp ";
cin >> lowtemp;
cout << "\n enter rain ";
cin >> amtrain;
cout << "\n enter snow ";
cin >> amtsnow;
}
void average(int i)
{
i++;
int a;
float avg;
a = hightemp + lowtemp + amtrain + amtsnow;
avg = (float)a/4;
cout<<endl<< "avg for day " << i << " = " << avg << endl;
}
};
int main()
{
int i, n;
weather_report w[5];
cout << "\n how many days:";
cin >> n;
cout << "\n enter data: "<<endl;
for (i = 0; i<n; i++)
{
w[i].Accept();
}
cout <<endl<<endl<< "entered data are";
for (i = 0; i<n; i++)
{
cout<<endl<< " " << endl << i + 1 << "day";
w[i].display();
}
cout <<endl<< endl;
for (i = 0; i<n; i++)
{
cout << endl<<"calculating avg ";
w[i].average(i);
}
return 0;
}
这里是Visual Studio的输出: -
/* output
how many days:3
enter data:
enter day 1
enater hightemp 45
enter lowtemp 25
enter rain 11
enter snow 13
enter day 2
enater hightemp 34
enter lowtemp 23
enter rain 12
enter snow 33
enter day 3
enater hightemp 54
enter lowtemp 34
enter rain 60
enter snow 23
entered data are
1day
1 45 25 11 13
2day
2 34 23 12 33
3day
3 54 34 60 23
calculating avg
avg for day 1 = 23.5
calculating avg
avg for day 2 = 25.5
calculating avg
avg for day 3 = 42.75
*/
calculating avg
avg for day 3 = 42.75
*/
但相同的代码不会对日食没有作品(海湾合作委员会编译器)
那么行21? –
_Missing separator_是'make'构建工具的错误,而不是源代码。所以问题出现在错误报告中指出的'subdir.mk'里面。我不确定makefile是由Eclipse自动生成的还是其他类型的问题。 – Jack
使用标签,而不是第21行的空格 –