First defined here error

Jul 12, 2015 at 1:36pm
Im trying to learn some C++ but I get a error at line 8 saying first defined here. I cant find out whats wrong

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
/*datatypes.cpp
12. jul. 2015
Drxxl
*/
#include <iostream>
using namespace std;
int main()
{
	char letter = 'a';
	short age = 10;
	int count = 575;
	long numStars = 985467528;
	float pi = 3.14;
	double price = 89.65;
	string season = "summer";

	cout<<"Letter: "<<letter<<endl;
	cout<<"Age: "<<age<<endl;
	cout<<"Count: "<<count<<endl;
	cout<<"Number of stars in the sky:"<<numStars<<endl;
	cout<<"Pi: "<<pi<<endl;
	cout<<"Price: $"<<price<<endl;
	cout<<season<<endl;
return 0;
}
Last edited on Jul 12, 2015 at 1:42pm
Jul 12, 2015 at 1:40pm
Code should work. Thy to create fresh project and compile it.
http://ideone.com/X9x24u
Jul 12, 2015 at 1:47pm
That worked thanks, Any idea why it did that?
Jul 12, 2015 at 1:53pm
You broke something in previous project. It is impossible to say for sure.
I think, you had more than one file with main() fucntion in your project.
Jul 12, 2015 at 1:54pm
Oh ok thank you!
Topic archived. No new replies allowed.