Problems Using Static Library
May 14, 2016 at 11:30pm UTC
I am attempting to write the code for a console application that uses a static library in another project. In this code I am getting many errors pertaining to incomplete types and type names not allowed. I'd greatly appreciate it if someone would be able to help me with this. Thank you!
Errors in lines:
ifstream infile;
infile.open("pay.txt");
e[i] = new employee[i];
and any line that uses the dynamic array for class employee
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
#include <iostream>
#include <string>
using namespace std;
#include "Employee.h"
using namespace employeepay;
int main()
{ int choice;
do {
string filename;
string* firstname;
double * hoursworked;
double * overtimehourlyrate;
employee *e[4]; //dynamic instance of employee 5/14
double h = 0, p = 0;
ifstream infile;
infile.open("pay.txt" );
for (int i = 0; i < n; ++i)
{
e[i] = new employee[i]; //dynamic array of employee 5/14
infile >> firstname >> hoursworked >> overtimehourlyrate >> e[i]; //input info to array 5/14
}
cout << "Employee Program" << endl << "1. Read employee info from file" << endl << "2. Write employee info to a file" << endl
<< "3. Show employee info on screen" << endl << "4. Show employee gross pay" << endl << "5. Exit" << endl;
cin >> choice;
if (choice == 1)
{
e.read(filename);
}
if (choice == 2)
{
e.read(filename);
e.write(filename);
}
if (choice == 3)
{
e.read(filename);
e.show();
}
if (choice == 4)
{
e.read(filename);
e.grosspay(h, p);
e.show();
}
if (choice == 5)
{
exit;
}
for (int i = 0; i < n; ++i)
{
delete [] employee[i]; //cleans up dynamically allocated memory 5/14
}
delete [] employee;
} while (choice != 5); //loops until user choice to end program 5/14
return 0;
system("pause" );
}
Topic archived. No new replies allowed.