473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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\microsoft visual studio 8\vc\include\iostream(53) : warning
C4091: 'extern __declspec(dllimport)' : ignored on left of
'std::basic_ostream<_Elem,_Traits>' when no variable is declared
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(927) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(927) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(927) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(927) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(920) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(920) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(920) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(920) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(913) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(913) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(913) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(913) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(906) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(906) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(906) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(906) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(868) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(868) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(868) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(868) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(822) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(822) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(822) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(822) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(782) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(782) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(782) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(782) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(735) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(735) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(735) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(735) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(697) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(697) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(697) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(697) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(650) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(650) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(650) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.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'
c:\program\microsoft visual studio 8\vc\include\ostream(650) :
see declaration of 'std::operator <<'
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 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_Ägaren
\Mina dokument\Visual Studio 2005\Projects\Program 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 3156
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*******@gmail.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...@comAcast.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\microsoft visual studio 8\vc\include\iostream(53) : warning
C4091: 'extern __declspec(dllimport)' : ignored on left of
'std::basic_ostream<_Elem,_Traits>' when no variable is declared
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
Build log was saved at "file://c:\Documents and Settings\HP_Ägaren
\Mina dokument\Visual Studio 2005\Projects\Program 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...@comAcast.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\microsoft visual studio 8\vc\include\iostream(53) : warning
C4091: 'extern __declspec(dllimport)' : ignored on left of
'std::basic_ostream<_Elem,_Traits>' when no variable is declared
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 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_Ägaren
\Mina dokument\Visual Studio 2005\Projects\Program 1\Program 1\Debug
\BuildLog.htm"
Program 1 - 1 error(s), 1 warning(s)
We can't help you with that, sorry. The "_declspec(dllimport)" syntax
is specific to Visual C++. Post to 'microsoft.public.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...@comAcast.netwrote:
ftjons...@gmail.com wrote:
On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@comAcast.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\microsoft visual studio 8\vc\include\iostream(53) : warning
C4091: 'extern __declspec(dllimport)' : ignored on left of
'std::basic_ostream<_Elem,_Traits>' when no variable is declared
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 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_Ägaren
\Mina dokument\Visual Studio 2005\Projects\Program 1\Program 1\Debug
\BuildLog.htm"
Program 1 - 1 error(s), 1 warning(s)

We can't help you with that, sorry. The "_declspec(dllimport)" syntax
is specific to Visual C++. Post to 'microsoft.public.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*******@gmail.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*******@gmail.comwrote:
On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@comAcast.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\microsoft visual studio 8\vc\include\iostream(53) : warning
C4091: 'extern __declspec(dllimport)' : ignored on left of
'std::basic_ostream<_Elem,_Traits>' when no variable is declared
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
Build log was saved at "file://c:\Documents and Settings\HP_Ägaren
\Mina dokument\Visual Studio 2005\Projects\Program 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.ruwrote:
Hello!
09.04.2007 at 17:47:55, <ftjons...@gmail.comwrote:


On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@comAcast.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\microsoft visual studio 8\vc\include\iostream(53) : warning
C4091: 'extern __declspec(dllimport)' : ignored on left of
'std::basic_ostream<_Elem,_Traits>' when no variable is declared
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
c:\documents and settings\hp_ägaren\mina dokument\visual studio
2005\projects\program 1\program 1\program 1.cpp(15) : error C2065:
'cout' : undeclared identifier
Build log was saved at "file://c:\Documents and Settings\HP_Ägaren
\Mina dokument\Visual Studio 2005\Projects\Program 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
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...
8
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...
30
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
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...
7
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....
0
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...
1
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...
0
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:...
11
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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...
0
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,...

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.