Numerous undeclared indentifer found in header file for one identifer, why?

Hello, pros:

I got frustrated why my identifier is unidentified...or is there some other structural issue?
Due in 1 day, would be appreciated if can help me figure out what is the mistake.

Its a program to tell day of a week when input number between 1~7.
It has 3 files: main.cpp,demoClass.cpp, demoClass.h

demoClass.h
-------------
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

class dayType
{
public:
	//public functions...
	void setDay (int&);
	void getDay (int&) const;
	void printDay(int);
	void printNextDay (int);
	void printPreviousDay (int);
	void forcastGetDay (int&);
	//void dayType::setDay(int day)
	//{
	//	for (int i=1;i<7;i++)
	//	{
	//		today_N = dayName[i];
	//	}
	//}
private:
	//private functions hide from users direct access.
    int day;

};


}


demoClass.cpp
--------
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include "demoClass.h"


void dayType::printDay(int day)
{
	std:: cout << "Today's Day is: "<<day<<std:: endl;

}



void  dayType::getDay (int &day) const
{
	std:: cout << "Its "<< dayName[day] <<" today."<<std:: endl;

}



void  dayType::printNextDay (int day)
{

	if ( day >=7)
	{
		std:: cout << "Its "<< dayName[1] <<" today."<<std:: endl;
	}
	else
	{
		std:: cout << "Its "<< dayName[day+1] <<" today."<<std:: endl;
	}
}



void  dayType::printPreviousDay (int day)
{
	if ( day <=1)
	{
		std:: cout << "Its "<< dayName[7] <<" today."<<std:: endl;
	}
	else
	{
		std:: cout << "Its "<< dayName[day-1] <<" today."<<std:: endl;
	}
}

void  dayType::forcastGetDay (int &day)
{
	std:: cout<<"Enter a number then I will get you the exact day after the days you specified: ";
	std:: cin >> day;


}



main.cpp
---------
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
32
33
34
35
36
37
#include <iostream>
#include "demoClass.h"

using namespace std;

string dayName [7] = {"Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
//pre initialization

void printDay(int day);
void getDay (int day);
void printNextDay (int day);
void printPreviousDay (int day);

int main()
{
	//initialization
	int todayDay;
	cout <<"Please input today's Day (if its Monday input 1, if its Sunday input 7, and etc):"<<endl;
	cin >>todayDay;
	void dayType (int todayDay);
	void printNextDay (int todayDay);
	void printPreviousDay (int todayDay);
	void forcastGetDay(int todayDay);


	//dayType.getDay (todayDay);
	
	/*
	demoClass anObj;
    anObj.setValue(10);
    anObj.showValue();
    */

    system("PAUSE");
    return 0;
}
What exactly is undefined? Post the error messages exactly as they appear please.
Error 1 error C2065: 'dayName' : undeclared identifier c:\cabinet\spring 2012\cis_4100programii\hw\2\democlass.cpp 15


here you go
also there is error:

6 IntelliSense: identifier "dayName" is undefined c:\cabinet\spring 2012\cis_4100programii\hw\2\democlass.cpp 15
firedraco, If you think its structural issue, would give me a hint or two so I can have a way to go?
Thank You
in democlass.h put the following line (outside of any class definition):

extern string dayName [7];

dayName is defined in main.cpp, but you try to use it in democlass.cpp where it isn't visible. If you place the forward declaration in your .h file it'll tell the compiler that you're using a variable that is defined elsewhere when the .h file is included in democlass.cpp.
Topic archived. No new replies allowed.