Header File Not Compiling

Ok so i'm VERY new to c++. I have looked thru endless search results, check thru 9 pages of posts, googled this problem, and cant seem to find anything. please forgive me if i have missed the answer, but i'm new to forums as well, so be gentle. anyway i am trying to understand header files, but cant seem to get mine to work. i am trying to learn c++ from an online tutorial, so i dont have anyone i can ask. every time i try to run my program i get the "expected initializer before int" compiler error. i was hoping maybe someone could help a noob learn something. here is the code.

main.cpp:
1
2
3
4
5
6
7
8
9
10
#include <iostream>
#include "add.h"

int main()

{
    using namespace std;
    cout << 3 + add(3, 4) << endl;
    return 0;
}


the add.cpp file:
1
2
3
4
int add(int x, int y) 
{
    return x+y;
}


and the header file:
1
2
3
4
5
6
#ifndef ADD_H_INCLUDED
#define ADD_H_INCLUDED

int add(int x, int y)

#endif  

Also i am using code::blocks 8.02 on the karmic release of ubuntu. THANKS in advance for the help.
Last edited on
Also, since i am new to forums, can somone please help me with separating the code into its own box. thought i had the answer, but as u can see i dont. thanks alot.
closed account (jwC5fSEw)
Put it in code tags: [code ][ /code] (just remove the spaces in the tags and enclose your code in them).

I don't know about your problem; however, you are missing a semicolon after the declaration in the header file.
thank you very much shadow addict. you solved BOTH of my problems. my pitiful lil program works like a charm now.
Topic archived. No new replies allowed.