Click here to Skip to main content
15,926,703 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CString problem in visual C++ 2005 Pin
Stephen Hewitt25-Nov-07 17:34
Stephen Hewitt25-Nov-07 17:34 
QuestionHow to use FindFirstFile and FindNextFile Pin
mrby12325-Nov-07 8:44
mrby12325-Nov-07 8:44 
AnswerRe: How to use FindFirstFile and FindNextFile Pin
Mark Salsbery25-Nov-07 8:56
Mark Salsbery25-Nov-07 8:56 
GeneralRe: How to use FindFirstFile and FindNextFile Pin
mrby12325-Nov-07 10:50
mrby12325-Nov-07 10:50 
AnswerRe: How to use FindFirstFile and FindNextFile Pin
Luc Pattyn25-Nov-07 9:17
sitebuilderLuc Pattyn25-Nov-07 9:17 
GeneralRe: How to use FindFirstFile and FindNextFile Pin
Mark Salsbery25-Nov-07 9:42
Mark Salsbery25-Nov-07 9:42 
AnswerRe: How to use FindFirstFile and FindNextFile Pin
Hamid_RT25-Nov-07 18:16
Hamid_RT25-Nov-07 18:16 
Questionlinker error - please help Pin
gizmokaka25-Nov-07 8:11
gizmokaka25-Nov-07 8:11 
Hello to all,
I never understand linker errors in visual studio,
I bring my class declaration, and the errors.
please advice me what to do.

header:
class Employee
{

public:
	Employee(char* name, int hourFee, int hoursPerMonth, int overTime);
	Employee(char* name, int hourFee, int hoursPerMonth);
	Employee(char* name, int hourFee);

	static int _minimumFee;
	static int _maximumHours;

	int getSalary();
	void print();
	int getHourFee();
	void setHourFee(int hourFee);
	int gethoursPerMonth();
	void setHoursPerMonth(int hours);

private:

	char* _name;
	int _hourFee;
	int _hoursPerMonth;
	int _overTime;
};


implementation:
#include"Employee.h"
#include<stdio.h>
#include<iostream>
#include<string.h>

using namespace std;

Employee::Employee(char* name, int hourFee, int hoursPerMonth, int overTime)
{
	_name = strdup(name);
	_hourFee = hourFee;
	_hoursPerMonth = hoursPerMonth;
	_overTime = overTime;
	Employee::_minimumFee = 3600;
	Employee::_maximumHours= 190;
}
Employee::Employee(char* name, int hourFee, int hoursPerMonth)
{
	Employee::Employee(name, hourFee, hoursPerMonth, 0);
}
Employee::Employee(char* name, int hourFee)
{
	Employee::Employee(name, hourFee, 160, 0);
}

int Employee::getSalary()
{
	return (_hourFee * _hoursPerMonth) + (_overTime * (_hourFee * 2));
}
void Employee::print()
{
	cout << "Employee, " << _name << " Salary = " << getSalary() << " hour Fee = " << _hourFee
		<< " hours of work per month " << _hoursPerMonth << " over hours made = " << _overTime << endl;
}

void Employee::setHourFee(int hourFee)
{
	if (hourFee < Employee::_minimumFee)
	{
		cout << "can't underpay a worker!!!" << endl;
		return;
	}
	else
	{
		_hourFee = hourFee;
	}
}
int Employee::getHourFee()
{
	return _hourFee;
}

int Employee::gethoursPerMonth()
{
	return _hoursPerMonth;
}


void Employee::setHoursPerMonth(int hours)
{
	if(hours > Employee::_maximumHours)
	{
		_hoursPerMonth = 190;
		_overTime = (hours - _hoursPerMonth);
	}
	else
	{
		_hoursPerMonth = hours;
	}
}


ERRORS:
error LNK2019: unresolved external symbol "public: static int Employee::_maximumHours" (?_maximumHours@Employee@@2HA) referenced in function "public: __thiscall Employee::Employee(char *,int,int,int)" (??0Employee@@QAE@PADHHH@Z) Employee.obj

Error	3	error LNK2019: unresolved external symbol "public: static int Employee::_minimumFee" (?_minimumFee@Employee@@2HA) referenced in function "public: __thiscall Employee::Employee(char *,int,int,int)" (??0Employee@@QAE@PADHHH@Z)	Employee.obj	<br />



please help me.
AnswerRe: linker error - please help Pin
Mark Salsbery25-Nov-07 8:35
Mark Salsbery25-Nov-07 8:35 
GeneralRe: linker error - please help Pin
gizmokaka25-Nov-07 8:39
gizmokaka25-Nov-07 8:39 
GeneralRe: linker error - please help Pin
Mark Salsbery25-Nov-07 8:46
Mark Salsbery25-Nov-07 8:46 
GeneralRe: linker error - please help Pin
gizmokaka25-Nov-07 8:46
gizmokaka25-Nov-07 8:46 
GeneralRe: linker error - please help Pin
Mark Salsbery25-Nov-07 8:49
Mark Salsbery25-Nov-07 8:49 
GeneralRe: linker error - please help Pin
gizmokaka25-Nov-07 8:55
gizmokaka25-Nov-07 8:55 
GeneralRe: linker error - please help Pin
Mark Salsbery25-Nov-07 8:59
Mark Salsbery25-Nov-07 8:59 
GeneralRe: linker error - please help Pin
gizmokaka25-Nov-07 9:14
gizmokaka25-Nov-07 9:14 
GeneralRe: linker error - please help Pin
Mark Salsbery25-Nov-07 9:20
Mark Salsbery25-Nov-07 9:20 
GeneralRe: linker error - please help Pin
gizmokaka25-Nov-07 9:39
gizmokaka25-Nov-07 9:39 
QuestionRecursion with Multiple Recursive Calls Pin
pourang25-Nov-07 7:18
pourang25-Nov-07 7:18 
QuestionRe: Recursion with Multiple Recursive Calls Pin
David Crow26-Nov-07 3:49
David Crow26-Nov-07 3:49 
Questionentry point of application Pin
George_George25-Nov-07 4:15
George_George25-Nov-07 4:15 
AnswerRe: entry point of application Pin
Gary R. Wheeler25-Nov-07 4:24
Gary R. Wheeler25-Nov-07 4:24 
GeneralRe: entry point of application Pin
George_George25-Nov-07 19:32
George_George25-Nov-07 19:32 
GeneralRe: entry point of application Pin
David Crow26-Nov-07 3:52
David Crow26-Nov-07 3:52 
GeneralRe: entry point of application Pin
George_George26-Nov-07 23:28
George_George26-Nov-07 23:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.