AngryWtf is wrong with this?

Posts 1–2 of 2 · Page 1 of 1
Wtf is wrong with this?
Hey, Plump here. I'm learning c++. And I seem to understand it pretty well, so I made a program that find sqrt's. But when I go to build it in Visual Studio 2010, it says this:
------ Build started: Project: Calculator, Configuration: Release Win32 ------

[code]stdafx.cpp
Calculator.cpp
Calculator.cpp(10): error C2065: 'cout' : undeclared identifier
Calculator.cpp(10): error C2065: 'endl' : undeclared identifier
Calculator.cpp(17): error C2084: function 'int main(void)' already has a body
Calculator.cpp(8) : see previous definition of 'main'
Calculator.cpp(20): error C3861: 'sqrt': identifier not found
Calculator.cpp(21): error C2065: 'cout' : undeclared identifier
Calculator.cpp(21): error C2065: 'endl' : undeclared identifier
------ Build started: Project: Calculator, Configuration: Debug Win32 ------
Calculator.cpp
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (10): error C2065: 'cout' : undeclared identifier
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (10): error C2065: 'endl' : undeclared identifier
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (17): error C2084: function 'int main(void)' already has a body
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (8) : see previous definition of 'main'
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (20): error C3861: 'sqrt': identifier not found
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (21): error C2065: 'cout' : undeclared identifier
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (21): error C2065: 'endl' : undeclared identifier
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

Whats the problem, as I'm only new to coding idk what the hells happening!
Quote Originally Posted by Plumpledore View Post
Hey, Plump here. I'm learning c++. And I seem to understand it pretty well, so I made a program that find sqrt's. But when I go to build it in Visual Studio 2010, it says this:
------ Build started: Project: Calculator, Configuration: Release Win32 ------
stdafx.cpp
Calculator.cpp
Calculator.cpp(10): error C2065: 'cout' : undeclared identifier
Calculator.cpp(10): error C2065: 'endl' : undeclared identifier
Calculator.cpp(17): error C2084: function 'int main(void)' already has a body
Calculator.cpp(8) : see previous definition of 'main'
Calculator.cpp(20): error C3861: 'sqrt': identifier not found
Calculator.cpp(21): error C2065: 'cout' : undeclared identifier
Calculator.cpp(21): error C2065: 'endl' : undeclared identifier
------ Build started: Project: Calculator, Configuration: Debug Win32 ------
Calculator.cpp
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (10): error C2065: 'cout' : undeclared identifier
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (10): error C2065: 'endl' : undeclared identifier
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (17): error C2084: function 'int main(void)' already has a body
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (8) : see previous definition of 'main'
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (20): error C3861: 'sqrt': identifier not found
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (21): error C2065: 'cout' : undeclared identifier
c:\users\catherine\documents\visual studio 2010\projects\calculator\calculator\calculator.cpp (21): error C2065: 'endl' : undeclared identifier
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

Whats the problem, as I'm only new to coding idk what the hells happening!
Actually post your code. People are too lazy to play Sherlock and guess what's wrong from the error log. I haven't touched C++ in a while, but it looks like you've defined main more than once in your code. Outside of that, have you included the Math header and the std namespace?
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

Talk with us