我是 C++ 新手,所以请耐心等待。当我编译时我得到这个错误。包括cpp和头文件。这是我得到的错误:
1>------ Build started: Project: 12_6, Configuration: Debug Win32 ------
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\Users\john\Documents\Visual Studio 2012\How to program\ch12_6\12_6\Debug\12_6.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
佣金雇员.h
#ifndef COMMISSION_H
#define COMMISSION_H
#include <string> // C++ standard string class
using namespace std;
class CommissionEmployee
{
public:
CommissionEmployee( const string &, const string &, const string &,
double = 0.0, double = 0.0 );
void setFirstName( const string & ); // set first name
string getFirstName() const; // return first name
void setLastName( const string & ); // set last name
string getLastName() const; // return last name
void setSocialSecurityNumber( const string & ); // set SSN
string getSocialSecurityNumber() const; // return SSN
void setGrossSales( double ); // set gross sales amount
double getGrossSales() const; // return gross sales amount
void setCommissionRate( double ); // set commission rate (percentage)
double getCommissionRate() const; // return commission rate
double earnings() const; // calculate earnings
void print() const; // print CommissionEmployee object
private:
string firstName;
string lastName;
string socialSecurityNumber;
double grossSales; // gross weekly sales
double commissionRate; // commission percentage
}; // end class CommissionEmployee
#endif
CommissionEmployee.cpp