Results 1 to 2 of 2

Thread: Build Error when Compiling - how to compile!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Location
    Ottawa
    Posts
    155

    Angry Build Error when Compiling - how to compile!

    Hi,
    I am a newbie!
    I want to create a DevC++ project that will compile a few classes with their header files in the correct order!

    Now I would like to understand something. Should all my class declarations be in a .h file and my class definitions be in a .cpp file?
    example:

    class Cat
    {
    private:
    int age;
    public:
    Cat();
    ~Cat();
    }

    Now should I include the top class declaration in Cat.h?

    how about the functions and methods for Cat class, do they go in my Cat.cpp?

    example:

    Cat::Cat()
    {
    cout<<Cat constructed!"<<endl;
    }

    Cat::~Cat()
    {
    cout<<Cat destructed!"<<endl;
    }

    does this code go in my Cat.cpp

    do I include "Cat.h" in my Cat.cpp file?

    now if i have a few more classes like this, how do i compile them all?

    say iw ant to run everything from a main class, which only has my main method

    please help.

    thank you.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Yes to all your questions that can be answered with yes.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width