1

Hello,

I just downloaded express C++ 2005 ed. and I can't get even a simple
code snippets to compile.

this is just a loop, the compiler does not compiles (cout)

this is what I get:
error C2065: 'cout' : undeclared identifier
Thank YOU:cry:
renny

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
	int counter = 0;
	while(counter <5)
	{
		counter++;
		cout <<"loping! ";
	}
	cout<<"\ncounter: " << counter << ".\n";





	return 0;
}

EDIT:
I have been programming for about 3 years in Dark Basic Pro. I know not a thing about C++
renny

4
Contributors
6
Replies
7
Views
11 Years
Discussion Span
Last Post by herge
1

Just put #include <iostream> after the #include "stdafx.h" line.
It would be better if you select the "Create Empty Project" option and then start from scratch. That gives you a better feel of things going on rather than using a template.

[edit] as dave said you need the using namespace std; line too. [/edit]

0

I tryed that and this is what I got:

Cannot open include file: 'iostream.h': No such file or directory

0

to Dave
Sorry I am new to C++ and do not know what you are talking about

0

Post your whole code again. You must have used

#include "iostream.h"
#include "stdafx.h"

instead of

#include "stdafx.h"
#include <iostream>
using namespace std;

or

#include "stdafx.h"
#include <iostream.h>
1

Hello,

I just downloaded express C++ 2005 ed. and I can't get even a simple
code snippets to compile.

this is just a loop, the compiler does not compiles (cout)

this is what I get:
error C2065: 'cout' : undeclared identifier
Thank YOU:cry:
renny

#include "stdafx.h"
 
 
int _tmain(int argc, _TCHAR* argv[])
{
    int counter = 0;
    while(counter <5)
    {
        counter++;
        cout <<"loping! ";
    }
    cout<<"\ncounter: " << counter << ".\n";
 
 
 
 
 
    return 0;
}

EDIT:
I have been programming for about 3 years in Dark Basic Pro. I know not a thing about C++
renny

try

#include <stdafx.h>

This should work I think!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.