473,761 Members | 5,163 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Errors in compilation of simple programme

hello,

I was wondering if anyone could tips me on what I am doing wrong when
writing the following code:

#include <iostream>
using namespace std;

int main ()
{
int i;

cout >"Hur gammal \x84r du? ";
cin << i;

cout >"Jaha...du \x84r" >i >" \x86r gammal.";

return 0;

I recieve the following errors:
------ Build started: Project: Program 1, Configuration: Debug Win32
------
Compiling...
Program 1.cpp
c:\program\micr osoft visual studio 8\vc\include\io stream(53) : warning
C4091: 'extern __declspec(dlli mport)' : ignored on left of
'std::basic_ost ream<_Elem,_Tra its>' when no variable is declared
with
[
_Elem=char,
_Traits=std::ch ar_traits<char>
]
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,unsigned char)' : could not
deduce template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(927) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,unsigned char)' : could not
deduce template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(927) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,unsigned char)' : could not
deduce template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(927) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,unsigned char)' : could not
deduce template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(927) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const unsigned char *)' : could
not deduce template argument for 'std::basic_ost ream<char,_Trai ts&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(920) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const unsigned char *)' : could
not deduce template argument for 'std::basic_ost ream<char,_Trai ts&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(920) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const unsigned char *)' : could
not deduce template argument for 'std::basic_ost ream<char,_Trai ts&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(920) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const unsigned char *)' : could
not deduce template argument for 'std::basic_ost ream<char,_Trai ts&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(920) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,signed char)' : could not deduce
template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(913) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,signed char)' : could not deduce
template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(913) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,signed char)' : could not deduce
template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(913) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,signed char)' : could not deduce
template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(913) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const signed char *)' : could
not deduce template argument for 'std::basic_ost ream<char,_Trai ts&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(906) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const signed char *)' : could
not deduce template argument for 'std::basic_ost ream<char,_Trai ts&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(906) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const signed char *)' : could
not deduce template argument for 'std::basic_ost ream<char,_Trai ts&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(906) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const signed char *)' : could
not deduce template argument for 'std::basic_ost ream<char,_Trai ts&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(906) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,_Elem)' : could not deduce
template argument for 'std::basic_ost ream<_Elem,_Tra its&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(868) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,_Elem)' : could not deduce
template argument for 'std::basic_ost ream<_Elem,_Tra its&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(868) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,_Elem)' : could not deduce
template argument for 'std::basic_ost ream<_Elem,_Tra its&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(868) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,_Elem)' : could not deduce
template argument for 'std::basic_ost ream<_Elem,_Tra its&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(868) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,const _Elem *)' : could not
deduce template argument for 'std::basic_ost ream<_Elem,_Tra its&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(822) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,const _Elem *)' : could not
deduce template argument for 'std::basic_ost ream<_Elem,_Tra its&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(822) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,const _Elem *)' : could not
deduce template argument for 'std::basic_ost ream<_Elem,_Tra its&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(822) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,const _Elem *)' : could not
deduce template argument for 'std::basic_ost ream<_Elem,_Tra its&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(822) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,char)' : could not deduce
template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(782) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,char)' : could not deduce
template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(782) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,char)' : could not deduce
template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(782) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,char)' : could not deduce
template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(782) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const char *)' : could not
deduce template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(735) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const char *)' : could not
deduce template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(735) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const char *)' : could not
deduce template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(735) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<char,_Trai ts&std::operato r
<<(std::basic_o stream<char,_Tr aits&,const char *)' : could not
deduce template argument for 'std::basic_ost ream<char,_Trai ts&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(735) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,char)' : could not deduce
template argument for 'std::basic_ost ream<_Elem,_Tra its&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(697) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,char)' : could not deduce
template argument for 'std::basic_ost ream<_Elem,_Tra its&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(697) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,char)' : could not deduce
template argument for 'std::basic_ost ream<_Elem,_Tra its&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(697) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,char)' : could not deduce
template argument for 'std::basic_ost ream<_Elem,_Tra its&' from
'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(697) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,const char *)' : could not
deduce template argument for 'std::basic_ost ream<_Elem,_Tra its&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(650) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,const char *)' : could not
deduce template argument for 'std::basic_ost ream<_Elem,_Tra its&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(650) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,const char *)' : could not
deduce template argument for 'std::basic_ost ream<_Elem,_Tra its&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(650) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2784:
'std::basic_ost ream<_Elem,_Tra its&std::operat or
<<(std::basic_o stream<_Elem,_T raits&,const char *)' : could not
deduce template argument for 'std::basic_ost ream<_Elem,_Tra its&'
from 'std::istream'
c:\program\micr osoft visual studio 8\vc\include\os tream(650) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(16) : error C2676:
binary '<<' : 'std::istream' does not define this operator or a
conversion to a type acceptable to the predefined operator
Build log was saved at "file://c:\Documents and Settings\HP_Äga ren
\Mina dokument\Visual Studio 2005\Projects\P rogram 1\Program 1\Debug
\BuildLog.htm"
Program 1 - 42 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========


Any help would be appreciated!

Thanks

Apr 9 '07 #1
8 3175
ft*******@gmail .com wrote:
hello,

I was wondering if anyone could tips me on what I am doing wrong when
writing the following code:

#include <iostream>
using namespace std;

int main ()
{
int i;
I recommend initialising it to 0.
>
cout >"Hur gammal \x84r du? ";
cin << i;
You got your shifts wrong. You shift *left* with 'cout' and *right*
with 'cin':

cout << "Hur gammal \x84r du? ";
cin >i;
>
cout >"Jaha...du \x84r" >i >" \x86r gammal.";

return 0;

I recieve the following errors:
[..]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Apr 9 '07 #2
Hello!
09.04.2007 at 17:18:29, <ft*******@gmai l.comwrote:
hello,

I was wondering if anyone could tips me on what I am doing wrong when
writing the following code:

#include <iostream>
using namespace std;

int main ()
{
int i;

cout >"Hur gammal \x84r du? ";
cin << i;

cout >"Jaha...du \x84r" >i >" \x86r gammal.";

return 0;

I recieve the following errors:
[Skip]
Any help would be appreciated!

Thanks
You forget about close bracket... i.e.
#include <iostream>
using namespace std;

int main ()
{
int i;

cout >"Hur gammal \x84r du? ";
cin << i;

cout >"Jaha...du \x84r" >i >" \x86r gammal.";

return 0;
} // <--- THIS IS REQUIRED!!

--
Best regards, acc15
Apr 9 '07 #3
On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
ftjons...@gmail .com wrote:
hello,
I was wondering if anyone could tips me on what I am doing wrong when
writing the following code:
#include <iostream>
using namespace std;
int main ()
{
int i;

I recommend initialising it to 0.
cout >"Hur gammal \x84r du? ";
cin << i;

You got your shifts wrong. You shift *left* with 'cout' and *right*
with 'cin':

cout << "Hur gammal \x84r du? ";
cin >i;
cout >"Jaha...du \x84r" >i >" \x86r gammal.";
return 0;

I fixed the obvious mistake and felt a little ashamed... but now it
spits out the following when compiling (exact same code with the
opposite shifts):

------ Build started: Project: Program 1, Configuration: Debug Win32
------
Compiling...
Program 1.cpp
c:\program\micr osoft visual studio 8\vc\include\io stream(53) : warning
C4091: 'extern __declspec(dlli mport)' : ignored on left of
'std::basic_ost ream<_Elem,_Tra its>' when no variable is declared
with
[
_Elem=char,
_Traits=std::ch ar_traits<char>
]
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
Build log was saved at "file://c:\Documents and Settings\HP_Äga ren
\Mina dokument\Visual Studio 2005\Projects\P rogram 1\Program 1\Debug
\BuildLog.htm"
Program 1 - 1 error(s), 1 warning(s)
@acc15

sorry about that...the last bracket w a s in, i just didnt paste it in

Apr 9 '07 #4
ft*******@gmail .com wrote:
On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
>ftjons...@gmai l.com wrote:
>>hello,
>>I was wondering if anyone could tips me on what I am doing wrong
when writing the following code:
>>#include <iostream>
using namespace std;
>>int main ()
{
int i;

I recommend initialising it to 0.
>>cout >"Hur gammal \x84r du? ";
cin << i;

You got your shifts wrong. You shift *left* with 'cout' and *right*
with 'cin':

cout << "Hur gammal \x84r du? ";
cin >i;
>>cout >"Jaha...du \x84r" >i >" \x86r gammal.";
>>return 0;


I fixed the obvious mistake and felt a little ashamed... but now it
spits out the following when compiling (exact same code with the
opposite shifts):

------ Build started: Project: Program 1, Configuration: Debug Win32
------
Compiling...
Program 1.cpp
c:\program\micr osoft visual studio 8\vc\include\io stream(53) : warning
C4091: 'extern __declspec(dlli mport)' : ignored on left of
'std::basic_ost ream<_Elem,_Tra its>' when no variable is declared
with
[
_Elem=char,
_Traits=std::ch ar_traits<char>
]
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
You did include <iostream>, didn't you? Then the reason for this error
is probably the warning up above.
Build log was saved at "file://c:\Documents and Settings\HP_Äga ren
\Mina dokument\Visual Studio 2005\Projects\P rogram 1\Program 1\Debug
\BuildLog.htm"
Program 1 - 1 error(s), 1 warning(s)
We can't help you with that, sorry. The "_declspec(dlli mport)" syntax
is specific to Visual C++. Post to 'microsoft.publ ic.vc.language'
about it. They should know.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Apr 9 '07 #5
On 9 Apr, 15:57, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
ftjons...@gmail .com wrote:
On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
ftjons...@gmail .com wrote:
hello,
>I was wondering if anyone could tips me on what I am doing wrong
when writing the following code:
>#include <iostream>
using namespace std;
>int main ()
{
int i;
I recommend initialising it to 0.
>cout >"Hur gammal \x84r du? ";
cin << i;
You got your shifts wrong. You shift *left* with 'cout' and *right*
with 'cin':
cout << "Hur gammal \x84r du? ";
cin >i;
>cout >"Jaha...du \x84r" >i >" \x86r gammal.";
>return 0;
I fixed the obvious mistake and felt a little ashamed... but now it
spits out the following when compiling (exact same code with the
opposite shifts):
------ Build started: Project: Program 1, Configuration: Debug Win32
------
Compiling...
Program 1.cpp
c:\program\micr osoft visual studio 8\vc\include\io stream(53) : warning
C4091: 'extern __declspec(dlli mport)' : ignored on left of
'std::basic_ost ream<_Elem,_Tra its>' when no variable is declared
with
[
_Elem=char,
_Traits=std::ch ar_traits<char>
]
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier

You did include <iostream>, didn't you? Then the reason for this error
is probably the warning up above.
Build log was saved at "file://c:\Documents and Settings\HP_Äga ren
\Mina dokument\Visual Studio 2005\Projects\P rogram 1\Program 1\Debug
\BuildLog.htm"
Program 1 - 1 error(s), 1 warning(s)

We can't help you with that, sorry. The "_declspec(dlli mport)" syntax
is specific to Visual C++. Post to 'microsoft.publ ic.vc.language'
about it. They should know.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask- Dölj citerad text -

- Visa citerad text -
Yes, <iostreamis included. Thanks for the help, I will check with
them!

Cheers

Apr 9 '07 #6
acc15 wrote:
Hello!
09.04.2007 at 17:18:29, <ft*******@gmai l.comwrote:
>hello,

I was wondering if anyone could tips me on what I am doing wrong when
writing the following code:

#include <iostream>
using namespace std;

int main ()
{
int i;

cout >"Hur gammal \x84r du? ";
cin << i;

cout >"Jaha...du \x84r" >i >" \x86r gammal.";

return 0;

I recieve the following errors:
[Skip]
Any help would be appreciated!

Thanks

You forget about close bracket... i.e.
#include <iostream>
using namespace std;

int main ()
{
int i;

cout >"Hur gammal \x84r du? ";
cin << i;

cout >"Jaha...du \x84r" >i >" \x86r gammal.";

return 0;
} // <--- THIS IS REQUIRED!!

--Best regards, acc15
However most of the errors are related to his use of cout and cin.
Notice how the direction of the arrows are all wrong?
Apr 9 '07 #7
Hello!
09.04.2007 at 17:47:55, <ft*******@gmai l.comwrote:
On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
>ftjons...@gmai l.com wrote:
hello,
I was wondering if anyone could tips me on what I am doing wrong when
writing the following code:
#include <iostream>
using namespace std;
int main ()
{
int i;

I recommend initialising it to 0.
cout >"Hur gammal \x84r du? ";
cin << i;

You got your shifts wrong. You shift *left* with 'cout' and *right*
with 'cin':

cout << "Hur gammal \x84r du? ";
cin >i;
cout >"Jaha...du \x84r" >i >" \x86r gammal.";
return 0;


I fixed the obvious mistake and felt a little ashamed... but now it
spits out the following when compiling (exact same code with the
opposite shifts):

------ Build started: Project: Program 1, Configuration: Debug Win32
------
Compiling...
Program 1.cpp
c:\program\micr osoft visual studio 8\vc\include\io stream(53) : warning
C4091: 'extern __declspec(dlli mport)' : ignored on left of
'std::basic_ost ream<_Elem,_Tra its>' when no variable is declared
with
[
_Elem=char,
_Traits=std::ch ar_traits<char>
]
c:\documents and settings\hp_äg aren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
Build log was saved at "file://c:\Documents and Settings\HP_Äg aren
\Mina dokument\Visual Studio 2005\Projects\P rogram 1\Program 1\Debug
\BuildLog.htm"
Program 1 - 1 error(s), 1 warning(s)
@acc15

sorry about that...the last bracket w a s in, i just didnt paste it in
As Victor said: The problem explicitly in arrow directions...
This code is right and works properly on my machine (VS 2005 PRO):

#include <iostream>
using namespace std;

int main ()
{
int i;

cout << "Hur gammal \x84r du? ";
cin >i;

cout << "Jaha...du \x84r" << i << " \x86r gammal.";

return 0;
}

Solution:
1. Create new console project with default settings (exception: without
Precompiled Headers!)
2. Create new file named 'main.cpp'.
3. Insert code listed above.
4. Build it.

Must working...
Otherwise the trouble is somewhere in Visual Studio settings. Try to
reinstall it.

--
Best regards, acc15
Apr 9 '07 #8
On 9 Apr, 17:15, acc15 <a...@comtv.ruw rote:
Hello!
09.04.2007 at 17:47:55, <ftjons...@gmai l.comwrote:


On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
ftjons...@gmail .com wrote:
hello,
I was wondering if anyone could tips me on what I am doing wrong when
writing the following code:
#include <iostream>
using namespace std;
int main ()
{
int i;
I recommend initialising it to 0.
cout >"Hur gammal \x84r du? ";
cin << i;
You got your shifts wrong. You shift *left* with 'cout' and *right*
with 'cin':
cout << "Hur gammal \x84r du? ";
cin >i;
cout >"Jaha...du \x84r" >i >" \x86r gammal.";
return 0;
I fixed the obvious mistake and felt a little ashamed... but now it
spits out the following when compiling (exact same code with the
opposite shifts):
------ Build started: Project: Program 1, Configuration: Debug Win32
------
Compiling...
Program 1.cpp
c:\program\micr osoft visual studio 8\vc\include\io stream(53) : warning
C4091: 'extern __declspec(dlli mport)' : ignored on left of
'std::basic_ost ream<_Elem,_Tra its>' when no variable is declared
with
[
_Elem=char,
_Traits=std::ch ar_traits<char>
]
c:\documents and settings\hp_äga ren\mina dokument\visual studio
2005\projects\p rogram 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
Build log was saved at "file://c:\Documents and Settings\HP_Äga ren
\Mina dokument\Visual Studio 2005\Projects\P rogram 1\Program 1\Debug
\BuildLog.htm"
Program 1 - 1 error(s), 1 warning(s)
@acc15
sorry about that...the last bracket w a s in, i just didnt paste it in

As Victor said: The problem explicitly in arrow directions...
This code is right and works properly on my machine (VS 2005 PRO):

#include <iostream>
using namespace std;

int main ()
{
int i;

cout << "Hur gammal \x84r du? ";
cin >i;

cout << "Jaha...du \x84r" << i << " \x86r gammal.";

return 0;

}

Solution:
1. Create new console project with default settings (exception: without
Precompiled Headers!)
2. Create new file named 'main.cpp'.
3. Insert code listed above.
4. Build it.

Must working...
Otherwise the trouble is somewhere in Visual Studio settings. Try to
reinstall it.

--
Best regards, acc15- Dölj citerad text -

- Visa citerad text -
Thanks for the info. I tried doing as you wrote acc15, but no luck. So
now I am going to see what is wrong with my computer, or try with a
completely different program. (No precompiled header, renamed the file
inserted the code, console app., build gave me a warning and an error,
the same as above.

Apr 9 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3314
by: Dave | last post by:
Hi folks, I am trying to develop a routine that will handle sphere-sphere and sphere-triangle collisions and interactions. My aim is to develop a quake style collision engine where a player can interact with a rich 3D environment. Seem to be 90% of the way there! My problems are related to calculations where the result tends to zero (or another defined limit.) Have loads of cases where this kind of interaction occurs but this one
8
1582
by: Gernot Frisch | last post by:
Hi, I get these errors, but I'm totally lost. It's a large cpp file and I don't know where to search for the error, since it does not point to any of my code lines. Can someone suggest where to start? That's my output: d:\Programme\Microsoft Visual Studio .NET 2003\Vc7\include\functional(139) : error C2784: 'bool std::operator
30
2186
by: prasanna | last post by:
i will be very thankful if you sent all the errors and warnings regarding to the language C thank you
24
2502
by: Massimo Soricetti | last post by:
Hello, I'm not a C newbie, but I'm teaching C programming (well... FIRST programming and then C) to other guys these days and it's driving me to some reflexions on the language. It's not uncommon to forget a } writing code, and at compiling time get an error 18956778 lines after the mistake, in an otherwise absolutely correct piece of code. Or, sometimes in my journeys I got errors reported in a file, checked and found it correct, and...
7
4501
by: Holger (David) Wagner | last post by:
Hi Group, I've searched the Web for precompilers that compile ASPX/ASCX pages just like it can be done with JSPs, but so far, I've only found approaches targetted at increasing the performance. What I'd like to do this for, however, is discovering compile-time errors during my normal build. Currently, just a typo in a Property name goes unnoticed until the page is hit the first time which is not particularly satisfying (this is like...
0
1191
by: Mythran | last post by:
I'm have 2 primary errors that seem to occur. 1.) In my ASP.Net application, I have 3 libraries (BLL, DAL, and Schema) that are used for the 4th and 5th UI libraries. All of the dependant libraries (the first 3) are required for COM+ and therefore also require to be given a strong-name. So we have. After reading on the MSDN site about how strong-named assemblies are not supported outside the GAC, I'm wondering why, every so often, we...
1
4266
by: | last post by:
I'm having a problem finding the cause for this problem. I have a solution in Visual Studio 2005 that contains two projects -- a Web Site and a Class Library. The web site references the class library. After the project became larger, the build process would sometimes fail with no errors. The "quick fix" for this was to rebuild the whole solution and things seemed ok. When this didn't solve the problem any longer, I went to the property...
0
1156
by: Debashish GHosh | last post by:
In my programme written in vb.net an erroor is comming in RELEASE mode while dubuging, but not giving no error while debuging in DEBUG mode. To describe shortly about my programme it is like this: Backend DATABASE: SQLITE 3.0 Interface: MAPX5.0 Programme Flow: Calling 1 dll and 1 exe, both are written in C#. I have checked all queries in the Sqlite browser; All are working fine; In my programme every steps are...
11
29268
by: cbderby | last post by:
''permission denied'' ''id returned 1 exit status'' im compiling with dev c++ 4.9.9.2 im using windows vista, but i have compiled and ran other programs before. pretty simple program, some parts in french, just wondering what i have to do fix it. #include <stdio.h> #include <stdlib.h>
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.