Error Cout Does Not Name A Type
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more error 'cout' in namespace 'std' does not name a type about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users cout does not name a type c++ Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping error cout is ambiguous each other. Join them; it only takes a minute: Sign up ‘cout’ does not name a type up vote 11 down vote favorite 3 I was learning Adam Drozdek's book "Data Structures and Algorithms in C++", well, I error does not name a type c++ typed the code in page 15 in my vim and compiled it in terminal of my Ubuntu 11.10. #include
Cout Was Not Declared In This Scope
= 30; cout << node1.name << ' ' << node1.age << ' ' << node2.name << ' ' << node2.age; But there's some error: oo@oo:~$ g++ unproper.cpp -o unproper unproper.cpp:15:23: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] unproper.cpp:16:1: error: ‘cout’ does not name a type unproper.cpp:17:7: error: expected constructor, destructor, or type conversion before ‘(’ token unproper.cpp:18:1: error: ‘node2’ does not name a type unproper.cpp:19:1: error: ‘cout’ does not name a type I have searched this,this,this and this, but I can't find the answer. Any help would be appreciated:) c++ share|improve this question edited Mar 29 '12 at 23:28 templatetypedef 199k44496753 asked Mar 29 '12 at 23:24 pvd 3992518 4 Where's main()? –Makoto Mar 29 '12 at 23:26 PHP developer, I see –ta.speot.is Mar 29 '12 at 23:28 1 You're missing your main. The code is outside of a function and is considered by the compiler to be either a declaration of variables, class, structs or other such commands. Just put all of the bottom code into int main() –SpaceToast Mar 29 '12 at 23:29 thanks:) I'm a Python developer:) –pvd Mar 30 '12 at 1:37 add a comment| 4 Answers 4 active oldest votes up vote 20 down vote accepted I think the problem is that the code you have that does the printing is outside of any function. Stat
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About
Expected Unqualified-id Before
Us Learn more about Stack Overflow the company Business Learn more about hiring error expected unqualified id before token developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join constructor c++ the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Why am I getting the http://stackoverflow.com/questions/9935027/cout-does-not-name-a-type error “cin does not name a type” up vote 1 down vote favorite While trying to write this code, I get an error "cin doesnt name a type". I don't know what the problem is exactly and I tried to write "using namespace std;" but it gave the same error. Here's the code #include
Reply 3 Replies - 10285 Views - Last Post: 27 August 2011 - 08:07 PM Rate Topic: #1 codercoder New D.I.C Head Reputation: http://www.dreamincode.net/forums/topic/245169-does-not-name-a-type-error/ 0 Posts: 24 Joined: 12-July 11 does not name a type error Posted https://bytes.com/topic/c/answers/634726-compilation-error-class-name-does-not-name-type 27 August 2011 - 07:50 PM Hello guys! I saw some vectors examples in deitel books and I am somehow playing around with the examples. But this error occurs every time I put the input and output functions in a template. Can anyone help me? It says "t does not does not name type" I sure I did include every header in my main but with no joy and I don't even know if it is the issue anyway. Thanks! #include
help? Post your question and get tips & solutions from a community of 418,509 IT Pros & Developers. It's quick & easy. Compilation Error:Class name does not name a type. P: n/a sharat hi groups, i have created 2 .cpp and .h(header) file and one main.cpp file, such as file1.cpp and .h similarly file2.cpp & .h . i have include the apropriate header files also .now i am creating the object of class A (which is declare and define in file1.h) into class B(which is declare and define in file2.h). i am getting an error that "class a " doesnot name a type and the object i have creted is undeclared . i am unable to get why this error is coming ,as i have includede the related header files also. can any body help to solve this problem. Thanx in advance... Apr 19 '07 #1 Post Reply Share this Question 13 Replies P: n/a Ian Collins sharat wrote: hi groups, i have created 2 .cpp and .h(header) file and one main.cpp file, such as file1.cpp and .h similarly file2.cpp & .h . i have include the apropriate header files also .now i am creating the object of class A (which is declare and define in file1.h) into class B(which is declare and define in file2.h). i am getting an error that "class a " doesnot name a type and the object i have creted is undeclared . i am unable to get why this error is coming ,as i have includede the related header files also. can any body help to solve this problem. Please post a minimal example that gives your problem. Otherwise all you can hope for is a guess. -- Ian Collins. Apr 19 '07 #2 P: n/a Salt_Peter On Apr 19, 2:28 am, sharat