Re: Errors in compilation of simple programme
ftjonsson@gmail.com wrote:
On 9 Apr, 15:26, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
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