Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Compiler errors

Reply
Thread Tools

Compiler errors

 
 
deanfamily11
Guest
Posts: n/a
 
      09-05-2005
When I run the following code through my compiler, I get C2065 and C2145
errors. Can someone help?


#include <iostream>
using namespace std;


int main ()
{
//declare variables
double dblin;
int intout;

//requesting a number
cout << "Enter a decimal number to round: ";

//user input
cin >> dblin;
cout << endl;

//round the number
intout = dblin;

//output the rounded number
cout << "The number rounded is ";
cout << intout;
cout << endl;

round 0;

}


 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      09-05-2005
deanfamily11 wrote:
> When I run the following code through my compiler, I get C2065 and C2145
> errors. Can someone help?
>


See below.

>
> #include <iostream>
> using namespace std;
>
>
> int main ()
> {
> //declare variables
> double dblin;
> int intout;
>
> //requesting a number
> cout << "Enter a decimal number to round: ";
>
> //user input
> cin >> dblin;
> cout << endl;
>
> //round the number
> intout = dblin;
>
> //output the rounded number
> cout << "The number rounded is ";
> cout << intout;
> cout << endl;
>
> round 0;
>


Should be

return 0;

Try reading the error messages next time, I got

error C2065: 'round' : undeclared identifier

Seems pretty clear to me.

john

> }
>
>

 
Reply With Quote
 
 
 
 
deanfamily11
Guest
Posts: n/a
 
      09-05-2005
I had read that, but didn't think to look down at the end. It's been awhile
since I did any C++ coding. Thanks for the help.

"John Harrison" <(E-Mail Removed)> wrote in message
news:MJ1Te.5277$(E-Mail Removed)...
> deanfamily11 wrote:
>> When I run the following code through my compiler, I get C2065 and C2145
>> errors. Can someone help?
>>

>
> See below.
>
>>
>> #include <iostream>
>> using namespace std;
>>
>>
>> int main ()
>> {
>> //declare variables
>> double dblin;
>> int intout;
>>
>> //requesting a number
>> cout << "Enter a decimal number to round: ";
>>
>> //user input
>> cin >> dblin;
>> cout << endl;
>>
>> //round the number
>> intout = dblin;
>>
>> //output the rounded number
>> cout << "The number rounded is ";
>> cout << intout;
>> cout << endl;
>>
>> round 0;
>>

>
> Should be
>
> return 0;
>
> Try reading the error messages next time, I got
>
> error C2065: 'round' : undeclared identifier
>
> Seems pretty clear to me.
>
> john
>
>> }



 
Reply With Quote
 
John Harrison
Guest
Posts: n/a
 
      09-05-2005
deanfamily11 wrote:
> I had read that, but didn't think to look down at the end. It's been awhile
> since I did any C++ coding. Thanks for the help.
>


If you double click on the error message it takes you to the line that
caused the error.

john
 
Reply With Quote
 
pk_prashant
Guest
Posts: n/a
 
      09-06-2005
To correct this error,

either, replace the 'round 0;' to 'return 0;' or,
change the 'int main ()' to 'void main()' and remove the 'return 0;'





deanfamily11 wrote:
> When I run the following code through my compiler, I get C2065 and C2145
> errors. Can someone help?
>
>
> #include <iostream>
> using namespace std;
>
>
> int main ()
> {
> //declare variables
> double dblin;
> int intout;
>
> //requesting a number
> cout << "Enter a decimal number to round: ";
>
> //user input
> cin >> dblin;
> cout << endl;
>
> //round the number
> intout = dblin;
>
> //output the rounded number
> cout << "The number rounded is ";
> cout << intout;
> cout << endl;
>
> round 0;
>
> }


 
Reply With Quote
 
=?ISO-8859-1?Q?Stefan_N=E4we?=
Guest
Posts: n/a
 
      09-06-2005
pk_prashant wrote:
> To correct this error,
>
> either, replace the 'round 0;' to 'return 0;' or,
> change the 'int main ()' to 'void main()' and remove the 'return 0;'


WRONG!

it's ALWAYS 'int main()' or 'int main(int argc, char* argv[])' and
NEVER EVER 'void main()'

So, the fix would be to change 'round 0;' to 'return 0;' or remove that line
completely.


/S.
 
Reply With Quote
 
Howard
Guest
Posts: n/a
 
      09-06-2005

"deanfamily11" <(E-Mail Removed)> wrote in message
news:sF1Te.16296$Sx4.12121@trnddc06...
> When I run the following code through my compiler, I get C2065 and C2145
> errors. Can someone help?
>
>


Please don't assume that, because your compiler reports those error codes,
everyone else's will also. Compilers differ on how they report errors.
There are no "standard" error codes. Indeed, there is no reason to even
assume that any "error code" at all is reported. You may only see text as
output from the compile attempt, such as "Syntax error, line16: ';' expected
here", or something similar. To most of us, "C2065" has no meaning
whatsoever. It's the text that tells us what is wrong, not some obscure
code.

Next time, let us know the text associated with the error code, not the
error code itself.

(Also, please place your replies _after_ the text to which you are replying,
not at the top. That's the standard for usenet postings.)

-Howard


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiler Error Message: The compiler failed with error code -1073741819 Ram ASP .Net 0 09-13-2005 09:52 AM
Compiler compiler with C++ as output Andrey Batyuck C++ 3 05-17-2004 08:17 PM
Can we use <compiler> tag to avoid RunTime Compiler error? Jack Wright ASP .Net 5 01-19-2004 04:36 PM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
Compiler Error Message: The compiler failed with error code 128. Yan ASP .Net 0 07-21-2003 10:49 PM



Advertisments