Compiler keeps giving out the error "unterminated #ifndef"

I am trying to make a class "specification" file so i can include it in my other .cpp file. But every time i try to run the program, the compiler keeps barking the "unterminated #ifndef", and i'm not entirely sure what that means.

Can someone enlighten me on what that means?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#ifndef COLOR_H
#define COLOR_H

using namespace std;

class Color			
{
    string black;			
    string white;			

public:
	string yellow;			
	string brown;			
        double number;

	void function (string x)		
        {
            cout << x << "\n";
        }



	double function1 (double y)	
        {
            return (y * 100);
        }


}fav,fav2, *pointer;



And here is the .cpp file that I am trying to give the specification file.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include "Color.h"

using namespace std;


int main ()
{
    pointer = new Color;

    pointer->yellow = "My least favorite color";

    pointer->function (pointer->yellow);


    pointer->number = 10;

    fav2.number = pointer->function1 (pointer->number);


    cout << fav2.number << "\n";

}

You need to match the #ifndef with a closing #endif

http://www.cprogramming.com/reference/preprocessor/ifndef.html
Topic archived. No new replies allowed.