When compiling I get a bunch of different errors such as "string does not name type" in EmployeeInfo.h also declaration does not declare anything in EmployeeInfo.h, also in payroll.cpp, Struct employee has no member named firstname and lastname, and other errors, I don't see where my errors are, please someone help me lol.
You can't just include headers whenever and wherever you feel like it, you need to include them before they're used. #include <string> in your EmployeeInfo.h file.
@Mr D I changed my source file to
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
#include "Employeeinfo.h"
(changed position of using namespace std)
I eliminated the string errors, but not I got a really really really long syntax error when im compiling it on unix. So is it just my code in general that is the problem ?
#include <iostream>
#include <iomanip>
#include <string>
usingnamespace std;
#include "Employeeinfo.h" // All your includes, followed by using namespace std, this is an include, isn't it? Switch this.
Without knowing what the error code is, I can't help you. But, putting ALL of the includes FIRST, followed by the namespace should solve your issue.
also, putting all includes first doesn't actually solve the issue because I would still get the string error, but after making the header file last, i would eliminate that error.
Lorence30 is correct, but it won't fix your error. Declaring usingnamespace std brings in the entire namespace and is considered bad practice, whereas just typing using std::string at the top of the file ( under your includes and header files ) specifies that you ONLY want to use the string of the standard library, which in effect is the same as typing std::string every time you want to use it, except it saves you some typing.