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行的空格 –