Identifier Undefined Issue
Nov 9, 2015 at 4:52am UTC
I'm new to C++ and am having issues regarding the last couple of lines, identifier 'ConsumerData' &'pp' is unidentified and '.pntInfo' must have class/struct/union. This is the main code, but I have ConsumerData.h, ConsumerData.cpp, PersonData.h, and PersonData.cpp.
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
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
int main(int argc, char ** argv) {
std::string lastNm;//last name
std::string firstNm;//first name
std::string address;//address
std::string city;//city
std::string state;//state
std::string phone;//phone
std::string zip;//zip
bool mailList;
//prompt user for the information
cout << "Last name: " ;
cin >> lastNm;
cout << "First name: " ;
cin >> firstNm;
cin.ignore();
cout << "Address: " ;
getline(cin, address);
cout << "City: " ;
getline(cin, city);
cout << "State: " ;
cin >> state;
cout << "Phone: " ;
cin >> phone;
cout << "ZIP: " ;
cin >> zip;
cout << "Mailing list (0 for false, otherwise it is for true): " ;
cin >> mailList;
//test the object
ConsumerData pp(lastNm, firstNm, address, city, state, zip, phone, mailList);
pp.pntInfo();
return 0;
}
Last edited on Nov 9, 2015 at 4:53am UTC
Nov 9, 2015 at 4:54am UTC
Did you define "ConsumerData" yourself?
It looks like you forgot to include the header file :)
The compiler can't do anything without that header file.
Add
1 2
#include "ConsumerData.h"
#include "PersonData.h"
to the top of your code with the other includes.
Since you defined the classes yourself, the name is in "" instead of <>.
Last edited on Nov 9, 2015 at 4:56am UTC
Nov 9, 2015 at 5:06am UTC
Thank you!! I was putting them in <> which I deleted because it only created more issues.
Topic archived. No new replies allowed.