tags:

views:

451

answers:

3

Hi, I am creating header file for the fist time in dev c++ I have created add.h and add.cpp according to proper format. I don't know where to store them and when I am using header, it is showing many errors

A: 

Doesn't matter where you save them, just put them in the same directory.

You include the header in your .cpp file like this:

#include "add.h"

Try googling for some beginner C++ tutorials.

Mark
+1  A: 

Typically my headers look like this:

#ifndef ADD_H
#define ADD_H

class Add
{
    ...
};
#endif

and I save them in the same directory as my .cpp files.

In the implementation file:

#include "add.h"

And then in the main cpp file:

#include "add.h"
Dave
You forgot the ';' at the end of your class. Why including the header in the main.cpp file. Just include it in each file where class 'add' is needed.
Patrice Bernassola
A: 

The problem that it is showing many errors is that you may have written incorrect code. You can start a new question, paste the part of code which you think is cause of the error, with a little description about your code and we'll happily help you out :)

hab