Like Tree2Likes

So I'm trying to get down classes

This is a discussion on So I'm trying to get down classes within the C++ Programming forums, part of the General Programming Boards category; And its really had when the tut says "see book" and the books say "look online" I have two books, ...

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    72

    So I'm trying to get down classes

    And its really had when the tut says "see book" and the books say "look online"

    I have two books, one form 1994 or so and one form 2005 (they made me broke for a while)

    But when I try to use them they don't work in my compilers, I can understand the 1994 one but the 2005 got me worried.

    Code:
    #include <iostream>
    #include <string>
    using namespace std;
    
    class grade_book // names the class "grade book"
    { 
         public: 
            void welcome_msg ()
    {
              cout<< "Welcome to grade book" << endl;
    		
    		
    
    	}
    };
    
    
    
    int main()
    {
    	grade_book my_grade_book;
    	my_grade_book.welcome_msg();
    	return 0;
    }
    so where is the msitake? is it in the book or is it just my two compilers?
    English is my first language, I'm just not any good at typing\writing it, I can read and speak it just fine.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,311
    Poor indentation, but the program works for me. What are the error messages that you get and with which compilers?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Sep 2011
    Posts
    72
    Dev C++ and microsoft visual C++ exspress

    Viusal studios says
    warning C4627: '#include <iostream>': skipped when looking for precompiled header use
    1> Add directive to 'StdAfx.h' or rebuild precompiled header
    Dev c++
    my_grade_book' undeclared
    English is my first language, I'm just not any good at typing\writing it, I can read and speak it just fine.

  4. #4
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Quote Originally Posted by Shawn Belcher View Post
    Dev C++ and microsoft visual C++ exspress

    Viusal studios says

    Dev c++
    When you make your project in Visual Studio, ensure you select empty console project. Then add your cpp file, paste that code in and try again.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  5. #5
    Registered User
    Join Date
    Sep 2011
    Posts
    72
    I did, it still dose nothing...
    English is my first language, I'm just not any good at typing\writing it, I can read and speak it just fine.

  6. #6
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Quote Originally Posted by Shawn Belcher View Post
    I did, it still dose nothing...
    Define "does nothing". Build errors? Linker errors? What does it do? It has to do something. Which version of Visual Studio?
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  7. #7
    Registered User
    Join Date
    Sep 2011
    Posts
    72
    2010 and I posted it in a edit (did not want to double post)

    it says
    warning C4627: '#include <iostream>': skipped when looking for precompiled header use
    1> Add directive to 'StdAfx.h' or rebuild precompiled header
    English is my first language, I'm just not any good at typing\writing it, I can read and speak it just fine.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,311
    Tell you what: create a new project with precompiled headers disabled.
    Salem likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Registered User
    Join Date
    Sep 2011
    Posts
    72
    It was I think, you mean when its comeply blanke? if so i did have it, I got screen shoots if you need them
    English is my first language, I'm just not any good at typing\writing it, I can read and speak it just fine.

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,311
    Not just a completely blank project, but one in which precompiled headers are disabled. There should be an optional selection for that.

    Alternatively, you actually do use the precompiled header.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    Quote Originally Posted by Shawn Belcher View Post
    2010 and I posted it in a edit (did not want to double post)

    it says
    When I say empty project I mean "Win32 Console Empty Project". Not a CLR project which is what you are still selecting.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  12. #12
    Registered User
    Join Date
    Sep 2011
    Posts
    72
    I'm consued, all i ahve
    is
    "empty project" which makes nothing on the file which is what i picked

    and "precompiled headers " So I'm sure I did what you asked...

    When I say empty project I mean "Win32 Console Empty Project". Not a CLR project which is what you are still selecting.
    Name:  Grade book_1.jpg
Views: 77
Size:  65.4 KB
    No I'm not
    Last edited by Shawn Belcher; 09-22-2011 at 10:47 PM.
    English is my first language, I'm just not any good at typing\writing it, I can read and speak it just fine.

  13. #13
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,866
    And you are still getting the same error?
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  14. #14
    Registered User
    Join Date
    Sep 2011
    Posts
    72
    Yes.
    English is my first language, I'm just not any good at typing\writing it, I can read and speak it just fine.

  15. #15
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,311
    Quote Originally Posted by Shawn Belcher
    I'm consued, all i ahve
    is
    "empty project" which makes nothing on the file which is what i picked

    and "precompiled headers " So I'm sure I did what you asked...
    After you click ok, is there another dialogue box that comes next?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Conversions between base classes and derived classes
    By tharnier in forum C++ Programming
    Replies: 14
    Last Post: 03-18-2011, 10:50 AM
  2. Classes access other classes local variables
    By parad0x13 in forum C++ Programming
    Replies: 6
    Last Post: 01-14-2010, 03:36 AM
  3. Classes being able to use other classes functions
    By rainmanddw in forum C++ Programming
    Replies: 6
    Last Post: 01-29-2006, 10:19 AM
  4. Classes with Other Classes as Member Data
    By njd in forum C++ Programming
    Replies: 2
    Last Post: 09-27-2005, 09:30 AM
  5. Help accessing classes and derived classes
    By hobbes67 in forum C++ Programming
    Replies: 8
    Last Post: 07-14-2005, 02:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21