mustish1
asked on
Error duing compilation
Hi guys: Can any one please tell me what does this error means ?
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Documents and Settings\Kathy\My Documents\test.cpp" -o "C:\Documents and Settings\Kathy\My Documents\test.exe" -I"C:\Dev-Cpp\lib\gcc\ming w32\3.4.2\ include" -I"C:\Dev-Cpp\include\c++\ 3.4.2\back ward" -I"C:\Dev-Cpp\include\c++\ 3.4.2\ming w32" -I"C:\Dev-Cpp\include\c++\ 3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Dev-Cpp\lib/libmingw32. a(main.o)( .text+0x10 6):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Execution terminated
-------------------------- ---------- ---------- ---------- ---------- -----
#include<string>
using namespace test;
class Employee
{
public:
Employee();
Employee(string, double);
void setEmployee(string, double);
double getSalary();
string getName();
void calcNewSalary(double);
private:
string name;
double salary;
};
Employee::Employee()
{
name = "";
salary = 0.0;
}
Employee::Employee(string n, double s)
{
name = n;
salary = s;
}
void Employee::setEmployee(stri ng n, double s)
{
name = n;
salary = s;
}
double Employee::getSalary()
{
return salary;
}
string Employee::getName()
{
return name;
}
void Employee::calcNewSalary(do uble r)
{
if(r >=0.0)
salary = salary * r + salary;
else
salary = 0.0;
}
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Documents and Settings\Kathy\My Documents\test.cpp" -o "C:\Documents and Settings\Kathy\My Documents\test.exe" -I"C:\Dev-Cpp\lib\gcc\ming
C:\Dev-Cpp\lib/libmingw32.
collect2: ld returned 1 exit status
Execution terminated
--------------------------
#include<string>
using namespace test;
class Employee
{
public:
Employee();
Employee(string, double);
void setEmployee(string, double);
double getSalary();
string getName();
void calcNewSalary(double);
private:
string name;
double salary;
};
Employee::Employee()
{
name = "";
salary = 0.0;
}
Employee::Employee(string n, double s)
{
name = n;
salary = s;
}
void Employee::setEmployee(stri
{
name = n;
salary = s;
}
double Employee::getSalary()
{
return salary;
}
string Employee::getName()
{
return name;
}
void Employee::calcNewSalary(do
{
if(r >=0.0)
salary = salary * r + salary;
else
salary = 0.0;
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
#include<string>
#include<iostream>
using namespace test;
class Employee
{
public:
Employee();
Employee(string, double);
void setEmployee(string, double);
double getSalary();
string getName();
void calcNewSalary(double);
private:
string name;
double salary;
};
Employee::Employee()
{
name = "";
salary = 0.0;
}
Employee::Employee(string n, double s)
{
name = n;
salary = s;
}
void Employee::setEmployee(stri
{
name = n;
salary = s;
}
double Employee::getSalary()
{
return salary;
}
string Employee::getName()
{
return name;
}
void Employee::calcNewSalary(do
{
if(r >=0.0)
salary = salary * r + salary;
else
salary = 0.0;
}
int main()
{
Employee myEmployee;
string name = "";
double pay = 0;
double rate = 0.0;
cout << "Employee's name:";
getline(cin, name);
cout << "Employee's current salary:";
cin >> pay;
cin.ignore(100, '\n');
cout << "Raise rate:";
cin >> rate;
cin.ignore(100, '\n');
myEmployee.setEmployee(nam
cout << "Name:" << myEmployee.getName() << endl;
cout << "Current salary: $" << myEmployee.getSalary() << endl;
myEmployee.calcNewSalary(r
cout << "New salary: $" << myEmployee.getSalary() << endl;
system("pause");
return 0;
}