Visual C++ (windows XP) can't compile #include <iostream>

I'm all new to C++

I wanted to check out if I could compile one easy script, that began with #include <iostream>

When I compile the script i get 200 lines of errors with cstlib and cstio
two different kinds of errors
1. syntax error: "missing '{' before ':'
2. syntax error: ':'

Why??
and what must I do?

Any help apreciated
Try to compile this;

1
2
3
4
5
6
7
#include <iostream>
int main()
{
    std::cout<<"Hello World!";
    std::cin.ignore();
    return 0;
}


If it does compile, your script isn't c++ sourcecode. If it doesn't: can you please post the error messages?
It doesn't...

it's iostream... the first error is because of the '::' in cstdio i believe....

Error message:
Setting environment for using Microsoft Visual Studio 2008 x86 tools.

C:\Program Files\Microsoft Visual Studio 9.0\VC>cl program.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

program.c
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(39) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(39) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(41) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(42) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(44) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(45) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(46) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(46) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(47) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(47) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(48) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(48) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(49) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(49) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(50) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(50) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(51) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(51) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(52) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(52) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(53) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(53) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(54) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(54) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(55) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(55) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(56) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(56) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(57) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(57) : error C2059
: syntax error : ':'
and the other part:
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(58) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(58) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(59) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(59) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(60) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(60) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(61) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(61) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(62) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(62) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(63) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(63) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(64) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(64) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(65) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(65) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(66) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(66) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(67) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(67) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(68) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(68) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(69) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(69) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(70) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(70) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(71) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(71) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(72) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(72) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(73) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(73) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(74) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(74) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(75) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(75) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(76) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(76) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(77) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(77) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(78) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(78) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(79) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(79) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(80) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(80) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(81) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(81) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(82) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(82) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(83) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(83) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(84) : error C2143
: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdio(84) : error C2059
: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(21) : error C214
3: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(21) : error C205
9: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(21) : error C214
3: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(21) : error C205
9: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(21) : error C214
3: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(21) : error C205
9: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(23) : error C214
3: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(23) : error C205
9: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(23) : error C214
3: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(23) : error C205
9: syntax error : ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(23) : error C214
3: syntax error : missing '{' before ':'
C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\cstdlib(23) : fatal erro
r C1003: error count exceeds 100; stopping compilation

C:\Program Files\Microsoft Visual Studio 9.0\VC>

(too long for one post...)
closed account (z05DSL3A)
Rename your code file: program.cpp
Oh, it was that easy? thanks

Isn't it supposed to be able of compiling .c-files too?

ahh is it because c++ is an extended version of the c language??
c and c++ are different languages, aldo they're really similar. But not everything that's possible in c can be done in c++, and there're a lot of things in c++ that can't be done in c.
http://www.cprogramming.com/tutorial/c-vs-c++.html
Topic archived. No new replies allowed.