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

Recommended Answers

All 6 Replies

Are you using namespace std ?

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]

I tryed that and this is what I got:

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

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

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>

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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.