473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

error C3861: 'xxxx': identifier not found

OK, I'm getting just this one error.

error C3861: 'upload_data': identifier not found

I have that function in the header file, why is it not seeing it? I can post code if needed.
Dec 1 '07 #1
3 21379
weaknessforcats
9,208 Expert Mod 8TB
Yes, the identifier not found means the compiler does not know about upload_data.

Check that everything is spelled correctly and that you are including the header file.

If that fails, then post your header file and the line of code where the error occurs.
Dec 1 '07 #2
I have called other functions from the header file, so I'm not sure why it doesn't like this one.

HourlyEmployee.h
Expand|Select|Wrap|Line Numbers
  1. #include "Employee.h"
  2. #include <iostream>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. #ifndef HOURLYEMPLOYEE_H
  8. #define HOURLYEMPLOYEE_H
  9.  
  10. class HourlyEmployee:public Employee
  11. {
  12.     private:
  13.         double hourly_wage;
  14.         double hours_worked;
  15.         string department_name;
  16.     public:
  17.         HourlyEmployee()
  18.         {
  19.             hourly_wage = 0;
  20.             hours_worked = 0;
  21.             department_name = "unknown";
  22.         }
  23.  
  24.         HourlyEmployee(double hwage, double hworked, string dname, string first, string last, string ID) : Employee(first, last, ID)
  25.         {
  26.             set_hourly_wage(hwage);
  27.             set_hours_worked(hworked);
  28.             set_department_name(dname);
  29.         }
  30.  
  31.         void set_hourly_wage(double hwage)
  32.         {
  33.             hourly_wage = hwage;
  34.         }
  35.  
  36.         void set_hours_worked(double hworked)
  37.         {
  38.             hours_worked = hworked;
  39.         }
  40.  
  41.         void set_department_name(string dname)
  42.         {
  43.             department_name = dname;
  44.         }
  45.  
  46.         double set_hourly_wage()
  47.         {
  48.             return hourly_wage;
  49.         }
  50.  
  51.         double set_hours_worked()
  52.         {
  53.             return hours_worked;
  54.         }
  55.  
  56.         string set_department_name()
  57.         {
  58.             return department_name;
  59.         }
  60.  
  61.         double compute_salary()
  62.         {
  63.             double pay;
  64.             pay = hourly_wage * hours_worked;
  65.             return pay;
  66.         }
  67.  
  68.         void display()
  69.         {
  70.             Employee::display();
  71.             cout << "Department name: " << department_name << endl;
  72.             cout << "2 weeks salary: $" << compute_salary() << endl;
  73.         }
  74.  
  75.         int upload_data(HourlyEmployee g[], int n)
  76.         {
  77.             int count = 0;
  78.             string first, last, id, dname;
  79.             double hworked, hwage;
  80.  
  81.             ifstream infile;
  82.             while(!infile.eof() && count<n)
  83.             {
  84.                 infile >> first >> last >> id >> hworked >> hwage >> dname;
  85.                 g[count].set_firstName(first);
  86.                 g[count].set_lastName(last);
  87.                 g[count].set_employeeID(id);
  88.                 g[count].set_hours_worked(hworked);
  89.                 g[count].set_hourly_wage(hwage);
  90.                 g[count].set_department_name(dname);
  91.                 count++;
  92.             }
  93.             return count;
  94.         }
  95. }
  96.  
  97. #endif
main.cpp
Expand|Select|Wrap|Line Numbers
  1. #include <iostream>
  2. #include "StaffEmployee.h"
  3. #include "HourlyEmployee.h"
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. #define SIZE 20
  9.  
  10. int main()
  11. {
  12.     int count;
  13.  
  14.     HourlyEmployee fellow;
  15.     fellow.display();
  16.  
  17.     cout << "" << endl;
  18.  
  19.     HourlyEmployee person(10, 55, "electronics", "Alan", "Good", "E1234");
  20.     person.display();
  21.  
  22.     HourlyEmployee group[SIZE];
  23.  
  24.     count = upload_data(group, SIZE);
  25.  
  26.     return 0;
  27. }
Dec 1 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
count = upload_data(group, SIZE);
upload_data is a member function. You can't just call it like this.
Dec 2 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: IceColdFire | last post by:
I have a VC++.net Win32 console application, however when I compile , I get this error error C2146: syntax error : missing ';' before identifier 'Length' Explain... Location pointed is ...
2
by: VicVic | last post by:
Hello, I have an old project, built with VC++. Now need to be compiled in Visual Studio .Net 2003. The project is going to build a DLL. When i try to compile the project, i got the following...
3
by: Ben | last post by:
Hi there, We have a asp.net application working fine till a patch is applied to the machine. Now it encounter error 404 page not found, although the page is there. Has anyone come across this...
7
by: Tony Tone | last post by:
I am having trouble resolving this issue: Server Error in '/test' Application. -------------------------------------------------------------------------------- Compilation Error Description:...
2
by: Hooyoo | last post by:
I have included windows.h, but it still says 'InitializeCriticalSectionAndSpinCount': identifier not found. Why? any ideas? Thanks.
2
by: P2P | last post by:
Hi all, I build my project on VS 2005 and get this error: c:\dx90sdk\include\strmif.h(27392) : error C2146: syntax error : missing ';' before identifier 'lpSurf' can you help me how to fix...
5
by: zhang | last post by:
error C3861: 'Navigate2': identifier not found why???
2
by: FARAECHILIBRU | last post by:
struct Node { int value; int phoneNo; string name; string surname; string adress; string Email; Node* pLeft;
1
by: Harshini Raj | last post by:
Hi, I am unable to fix this error. Canyou tell me what compiler options i have to use to fix this issue? Issue Error 40:Undeclared identifier 'Name' -- Within an expression, an identifier was...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.