'_TCHAR' has not been declared

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<iostream>
#include<fstream>
#include<string>


int _tmain(int argc, _TCHAR* argv[])
{
	std::fstream file;
	std::string temp;
	double first,second,third;
	file.open("rm.txt");
	/*
	while(file.good())
	{
		std::getline(file,temp);
		std::cout<<temp<<std::endl;
	}
	*/
	while(file.good())
	{
		std::getline(file,temp);
		std::getline(file,temp);
		std::getline(file,temp);
		file>>temp;
		file>>temp;
		file>>temp;
		file>>temp;
		file>>first;
		file>>temp;
		file>>temp;
		file>>temp;
		file>>temp;
		file>>temp;
		file>>second;
		file>>temp;
		file>>temp;
		file>>temp;
		file>>temp;
		file>>temp;
		file>>third;
		std::getline(file,temp);
		std::cout<<"Diagonals are : "<<first<<" "<<second<<" "<<third<<std::endl;
	}
	file.close();
	system("PAUSE");
	return 0;
}


When i tried to compile it is showing an error like system is not declared in the scope and '_TCHAR' has not been declared
To my knowledge, _tmain() and _TCHAR are non-standard Microsoft extensions.

Try using main() and char instead, as in:

int main(int argc, char *argv[])
Topic archived. No new replies allowed.