Swarna Kumar
Swarna Kumar

Reputation:

how to create a header file in dev c++

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

Upvotes: 0

Views: 14527

Answers (3)

akif
akif

Reputation: 12344

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 :)

Upvotes: 0

Dave
Dave

Reputation: 1095

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"

Upvotes: 2

mpen
mpen

Reputation: 283043

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.

Upvotes: 0

Related Questions