0

Hello everyone,
I`m new in this forum , and I`m an absolute beginer in C++ language.
Therefor i already have some major problems in my learning.
My compiler is giving me odd errors eventhough the codes are typed in corectly , exactly as in the book.
Here are some of the errors:
1>.\lines.cpp(3) : error C2146: syntax error : missing ';' before identifier 'std'
1>.\lines.cpp(3) : error C2873: 'namepsace' : symbol cannot be used in a using-declaration
1>.\lines.cpp(3) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>.\lines.cpp(3) : error C2365: 'std' : redefinition; previous definition was 'namespace'
1>.\lines.cpp(7) : error C2065: 'cout' : undeclared identifier
1>.\lines.cpp(8) : error C2065: 'cout' : undeclared identifier
1>.\lines.cpp(9) : error C2065: 'cout' : undeclared identifier
1>.\lines.cpp(10) : error C2065: 'cin' : undeclared identifier
1>.\lines.cpp(10) : error C2228: left of '.get' must have class/struct/union
1> type is ''unknown-type''
________________________
I can`t understand aything because in my books says that everething is corect and I`m totally confused.Please help me.

3
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by bill2
Featured Replies
  • Oh I see now -- the problem is that you misspelled "namespace". >>If I`m doing mistakes sorry but I`m still practising English. Your English is pretty good -- you are doing a good job at it :) Read More

0

Since you didn't post any code I can only guess that you failed to include header files and identify the namespace.

#include <iostream>
using namespace std;
...
...
/blabla
0
#include<stdafx.h>
#include<iostream>
using namepsace std;

int main()
{
	cout<<"I am Blaxxxon/n";
	cout<<"The godlike computer/n";
	cout<<"Fear me!!!/n";
	cin.get();
	return 0;
}

____________
Thoes were the codes.I can`t see any mistake.I am still confused with the errors.I must reinstall the compiler?

0

what compiler and version of compiler are you using? The first header file, stdafx.h, is for Microsoft compilers, and should be surrounded with quotes, not angle brackets #include "stdafx.h"

0

Well , I`m using Microsoft Visual C++ 2008 express edition.
I`ve tried to replace the brackets with " but still the same errors.
The odd thing is that some programs worked but some didn`t.
All the programs were simple codes for beginers like the one i`ve showed you.
If I`m doing mistakes sorry but I`m still practising English.
And one more thing , I`m using windows vista home edition.Has that something to do with my compiler eficiency?

0

Leave #include<stdafx.h> out.
Btw:
Computers are not god.
Computers should not be feared.
Use another learn C++ book.

1

Oh I see now -- the problem is that you misspelled "namespace".

>>If I`m doing mistakes sorry but I`m still practising English.
Your English is pretty good -- you are doing a good job at it :)

Votes + Comments
RESPECT! You have a fine eye!
0

How dummy I am...thank you for opening my eyes and I`m sorry for jumping in a conversation with you before reading the site FAQ and rules.
Thank you again

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.