A
Allen
Below are 4 forms. Namely: Form1, EmployeeID, AboutBox and
EnterEmployeeName. I made a class to help in open, write and read from
files called Time. I managed to declare class Time in EmployeeID space, but
could not declare it in EnterEmployeeName. In other words, I can declare
class Time in one space only. I really want to use class Time in both forms
EmployeeID and EnterEmployeeName. Can anybody tell me why I always get
error below, every time I run the program? And how can I use the Time class
in both the above forms?
1>c:\users\allen\documents\visual studio
2008\projects\timetracking\timetracking\Time.h(5) : error C2011: 'Time' :
'class' type redefinition
1> c:\users\allen\documents\visual studio
2008\projects\timetracking\timetracking\Time.h(5) : see declaration of
'Time'
1>EnterEmployeeName.cpp
#pragma once
#include "AboutBox.h"
#include "EmployeeID.h"
#include "EnterEmployeeName.h"
namespace TimeTracking
{
using namespace System::Windows::Forms;
public ref class Form1 : public System::Windows::Forms::Form
{
};
}
/***************************/
#pragma once
#include "Time.h"
//#include "stdafx.h"
#using <mscorlib.dll>
namespace TimeTracking
{
public ref class EmployeeID : public System::Windows::Forms::Form
{
};
}
/***************************/
#pragma once
namespace TimeTracking
{
public ref class AboutBox : public System::Windows::Forms::Form
{
};
}
/***************************/
#pragma once
#include "stdafx.h"
//#include "Time.h" //-------------uncomment and get error C2011
namespace TimeTracking
{
public ref class EnterEmployeeName : public System::Windows::Forms::Form
{
};
}
/***************************/
using namespace System;
ref class Time
{
};
/***************************/
#include "stdafx.h"
#include "Time.h"
#using <mscorlib.dll>
EnterEmployeeName. I made a class to help in open, write and read from
files called Time. I managed to declare class Time in EmployeeID space, but
could not declare it in EnterEmployeeName. In other words, I can declare
class Time in one space only. I really want to use class Time in both forms
EmployeeID and EnterEmployeeName. Can anybody tell me why I always get
error below, every time I run the program? And how can I use the Time class
in both the above forms?
1>c:\users\allen\documents\visual studio
2008\projects\timetracking\timetracking\Time.h(5) : error C2011: 'Time' :
'class' type redefinition
1> c:\users\allen\documents\visual studio
2008\projects\timetracking\timetracking\Time.h(5) : see declaration of
'Time'
1>EnterEmployeeName.cpp
#pragma once
#include "AboutBox.h"
#include "EmployeeID.h"
#include "EnterEmployeeName.h"
namespace TimeTracking
{
using namespace System::Windows::Forms;
public ref class Form1 : public System::Windows::Forms::Form
{
};
}
/***************************/
#pragma once
#include "Time.h"
//#include "stdafx.h"
#using <mscorlib.dll>
namespace TimeTracking
{
public ref class EmployeeID : public System::Windows::Forms::Form
{
};
}
/***************************/
#pragma once
namespace TimeTracking
{
public ref class AboutBox : public System::Windows::Forms::Form
{
};
}
/***************************/
#pragma once
#include "stdafx.h"
//#include "Time.h" //-------------uncomment and get error C2011
namespace TimeTracking
{
public ref class EnterEmployeeName : public System::Windows::Forms::Form
{
};
}
/***************************/
using namespace System;
ref class Time
{
};
/***************************/
#include "stdafx.h"
#include "Time.h"
#using <mscorlib.dll>