Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Question] Compiling in VC++ 2005

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Kamikaze
Grandmaster Cheater Supreme
Reputation: 0

Joined: 03 Jul 2007
Posts: 1180
Location: The Lowlands.

PostPosted: Wed Jul 09, 2008 3:11 pm    Post subject: [Question] Compiling in VC++ 2005 Reply with quote

I tried to compile this:

Code:
#include "stdafx.h"
#include <iostream>

void main()
{
   //define variables
   float num1;
   float num2;
   float total;

   //Enter data for the variables
   cout << "Enter a value for the first variable;  ";
   cin >> num1;
   cout << "Enter a value for the second variable;  ";
   cin << num2;

   //Add the two numbers together
   total = num1 + num2;

   //Display the result
   cout << "The sum of the numbers = " << total << endl;

}


Got these errors:

Code:
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(13) : error C2065: 'cout' : undeclared identifier
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(14) : error C2065: 'cin' : undeclared identifier
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(22) : error C2065: 'endl' : undeclared identifier


I guess cin and cout and endl are old identifiers, but what are the new one? Because it should be a calculator. I made this with the video tutorial somewhere in the forum

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Wed Jul 09, 2008 4:02 pm    Post subject: Reply with quote

You didn't include the namespace. If you don't use the namespace then you need to add std:: infront of cout, cin, and endl.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Wed Jul 09, 2008 4:03 pm    Post subject: Reply with quote

Code:
using namespace std;

or
Code:

std::cout
std::cin
std::endl
Back to top
View user's profile Send private message MSN Messenger
Kamikaze
Grandmaster Cheater Supreme
Reputation: 0

Joined: 03 Jul 2007
Posts: 1180
Location: The Lowlands.

PostPosted: Wed Jul 09, 2008 4:19 pm    Post subject: Reply with quote

Thanks you very much, both of you Smile

EDIT:

Code:
1>------ Build started: Project: Calculator, Configuration: Debug Win32 ------
1>Compiling...
1>Calculator.cpp
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(927) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(927) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(927) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,unsigned char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(927) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(920) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(920) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(920) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const unsigned char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(920) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(913) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(913) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(913) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,signed char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(913) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(906) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(906) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(906) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const signed char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(906) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(868) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(868) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(868) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,_Elem)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(868) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(822) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(822) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(822) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const _Elem *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(822) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(782) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(782) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(782) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(782) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(735) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(735) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(735) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<char,_Traits> &std::operator <<(std::basic_ostream<char,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<char,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(735) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(697) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(697) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(697) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,char)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(697) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(650) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(650) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(650) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const char *)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream'
1>        c:\program files\microsoft visual studio 8\vc\include\ostream(650) : see declaration of 'std::operator <<'
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(16) : error C2676: binary '<<' : 'std::istream' does not define this operator or a conversion to a type acceptable to the predefined operator
1>c:\documents and settings\shotta\my documents\visual studio 2005\projects\calculator\calculator\calculator.cpp(22) : error C2065: 'endl' : undeclared identifier
1>Build log was saved at "file://c:\Documents and Settings\Shotta\My Documents\Visual Studio 2005\Projects\Calculator\Calculator\Debug\BuildLog.htm"
1>Calculator - 42 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I am new to this all, and I don't know all these terms..

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites