|
-
May 13th, 2013, 04:24 PM
#16
Re: Unresolved external symbol
 Originally Posted by crisdeveloper
not. these txt editors only show me a empty txt.
That's because you are not setting the class members properly! See my comment in post #14 regarding the class problem
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 13th, 2013, 04:28 PM
#17
Re: Unresolved external symbol
i already tried it but the wrong form:
this.Name instead this->Name
i change according you told me and i´m compiling the program now.
-
May 13th, 2013, 04:30 PM
#18
Re: Unresolved external symbol
this is my update code
Code:
// Using_class_ in_ c++.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
using namespace std;
class Person
{
public:
//Constructor and Destructor Methods
Person(){cout<<"\n\tBuilding a Person.";};
~Person(){cout<<"\n\tDestroying a Person.";};
//Accessor Methods
string getName (){ return Name; }
string getLocation (){ return Location; }
string getAge (){ return Age; }
string getOccupation (){ return Occupation; }
void setName (string Name) { this->Name = Name; }
void setLocation (string Location) { this->Location = Location; }
void setAge (string Age) { this->Age = Age; }
void setOccupation (string Occupation) { this->Occupation = Occupation; }
private:
string Name,
Location,
Age,
Occupation;
};
//Function prototypes
void createPerson();
void editPerson();
void displayPerson();
void savePerson();
void loadPerson();
Person* cg = new Person();
int main (int argc, char *argv[])
{
char choose[10] = "";
cout<<"\n\t Personnel database 1.0\n";
//system display ("CLS");
while (choose [0] != 'q')
{
system ("CLS");
cout<<"\n\t---------------------Main Menu---------------------\n";
cout<<"\n\t| |\n";
cout<<"\n\t| (c) Create person |\n";
cout<<"\n\t| (e) edit information |\n";
cout<<"\n\t| (d) display person |\n";
cout<<"\n\t| (s) Save person |\n";
cout<<"\n\t| (l) Load person |\n";
cout<<"\n\t| (q) quit |\n";
cout<<"\n\t| |\n";
cout<<"\n\t---------------------------------------------------\n\n\t";
cin>>choose;
//system ("CLS");
switch (choose [0])
{
//system ("CLS");
case 'c': createPerson(); break;
case 'e': editPerson(); break;
case 'd': displayPerson(); system ("pause"); break;
case 's': savePerson(); break;
case 'l': loadPerson(); break;
case 'q': cout<<"\n\tExiting main menu..."; break;
default :"\n\tInvalid input!";
}
}
system ("pause");
return 0;
}
//Function´s scope
void createPerson()
{
editPerson();
}
void editPerson()
{
string TEMP;
system ("CLS");
cout<<"\n\n\t---------------------EDIT person ---------------------------";
cout<<"\n\t Name: ";
cin.ignore();
getline (cin,TEMP);
cg->setName(TEMP);
cout<<"\n\t Location ";
getline (cin,TEMP);
cg->setLocation(TEMP);
cout<<"\n\t Age: ";
getline (cin,TEMP);
cg->setAge(TEMP);
cout<<"\n\t Occupation: ";
getline (cin,TEMP);
cg->setOccupation(TEMP);
}
void displayPerson()
{
system("CLS");
cout<<"\n\n\t---------------------person information----------------------";
cout<< "\n\tName: " , cg-> getName();
cout<< "\n\tLocation:" , cg-> getLocation();
cout<< "\n\tAge: " , cg-> getAge();
cout<< "\n\tOccupation:" , cg-> getOccupation();
cout<<"\n\n\t---------------------------------------------------------------\n\n";
}
void savePerson()
{
try
{
ofstream DATAFILE;
DATAFILE.open("Data1.file",ios::out);
DATAFILE <<cg->getName ()<<"\n";
DATAFILE <<cg->getLocation ()<<"\n";
DATAFILE <<cg->getAge ()<<"\n";
DATAFILE <<cg->getOccupation ()<<"\n";
DATAFILE.close(); //Prevents data from getting corrupt incase of sudden shutdown
cout<<"\n\t Success! Data was saved to file.";
}
catch (exception x)
{
cout<<"\n\t File Error! Could not SAVE PERSON.";
}
}
void loadPerson()
{
try
{
string TEMP;
ifstream DATAFILE;
DATAFILE.open("Data1.file",ios::in);
getline (DATAFILE,TEMP);
cg->setName (TEMP);
getline (DATAFILE,TEMP);
cg->setLocation (TEMP);
getline (DATAFILE,TEMP);
cg->setAge (TEMP);
getline (DATAFILE,TEMP);
cg->setOccupation (TEMP);
DATAFILE.close();
}
catch (exception x)
{
cout<<"\n\t File Error! Unable to load data.";
}
}
Last edited by crisdeveloper; May 13th, 2013 at 04:34 PM.
-
May 13th, 2013, 04:38 PM
#19
Re: Unresolved external symbol
have a nice evening, tomorrow i´ll see this problem again.
-
May 13th, 2013, 05:01 PM
#20
Re: Unresolved external symbol
 Originally Posted by crisdeveloper
this is my update code
Code:
//Accessor Methods
string getName const (){ return Name; }
string getLocation const (){ return Location; }
string getAge const (){ return Age; }
string getOccupation const (){ return Occupation; }
Functions that do not change the class internals should be defined as const.
Code:
void setName (const string& Name) { this->Name = Name; }
void setLocation (const string & Location) { this->Location = Location; }
void setAge (const string & Age) { this->Age = Age; }
void setOccupation (const string & Occupation) { this->Occupation = Occupation; }
Objects such as std::string should be passed by reference or const reference, not by value.
What is the reason for dynamically allocating here?
Code:
Person* cg = new Person();
Why not just do this:
Regards,
Paul McKenzie
-
May 14th, 2013, 10:03 AM
#21
Re: Unresolved external symbol
i broke my code in two parts:
headers:
Code:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include "Person.h"
#include <iostream>
#include <string>
#include <fstream>// enable writing to and reading from files
#include <cstdlib>
#include <time.h>
// TODO: reference additional headers your program requires here
Person.h:
Code:
#ifndef PERSON_H
#define PERSON_H
class Person
{
public:
//Constructor and Destructor Method
Person(){cout<<"\n\tBuilding a Person.";};
~Person(){cout<<"\n\tDestroying a Person.";};
//Accessor Methods
string getName ()const { return Name; }
string getLocation ()const { return Location; }
string getAge ()const{ return Age; }
string getOccupation ()const{ return Occupation; }
void setName (const string& Name) { this->Name = Name; }
void setLocation (const string& Location) { this->Location = Location; }
void setAge (const string& Age) { this->Age = Age; }
void setOccupation (const string& Occupation) { this->Occupation = Occupation; }
void createPerson();
void editPerson();
void displayPerson();
void savePerson();
void loadPerson();
private:
string Name,
Location,
Age,
Occupation;
};
# endif
void Person::createPerson()
{
editPerson();
}
void Person::editPerson()
{
string TEMP;
system ("CLS");
cout<<"\n\n\t---------------------EDIT person ---------------------------";
cout<<"\n\t Name: ";
cin.ignore();
getline (cin,TEMP);
setName(TEMP);
cout<<"\n\t Location ";
getline (cin,TEMP);
setLocation(TEMP);
cout<<"\n\t Age: ";
getline (cin,TEMP);
setAge(TEMP);
cout<<"\n\t Occupation: ";
getline (cin,TEMP);
setOccupation(TEMP);
}
void Person::displayPerson()
{
system("CLS");
cout<<"\n\n\t---------------------person information----------------------";
cout<< "\n\tName: " , getName();
cout<< "\n\tLocation:" , getLocation();
cout<< "\n\tAge: " , getAge();
cout<< "\n\tOccupation:" , getOccupation();
cout<<"\n\n\t---------------------------------------------------------------\n\n";
}
void Person::savePerson()
{
try
{
ofstream DATAFILE;
DATAFILE.open("Data1.file",ios::out);
DATAFILE <<getName ()<<"\n";
DATAFILE <<getLocation ()<<"\n";
DATAFILE <<getAge ()<<"\n";
DATAFILE <<getOccupation ()<<"\n";
DATAFILE.close(); //Prevents data from getting corrupt incase of sudden shutdown
cout<<"\n\t Success! Data was saved to file.";
}
catch (exception x)
{
cout<<"\n\t File Error! Could not SAVE PERSON.";
}
}
void Person::loadPerson()
{
try
{
string TEMP;
ifstream DATAFILE;
DATAFILE.open("Data1.file",ios::in);
getline (DATAFILE,TEMP);
setName (TEMP);
getline (DATAFILE,TEMP);
setLocation (TEMP);
getline (DATAFILE,TEMP);
setAge (TEMP);
getline (DATAFILE,TEMP);
setOccupation (TEMP);
DATAFILE.close();
}
catch (exception x)
{
cout<<"\n\t File Error! Unable to load data.";
}
}
Using_class_in_c++.cpp:
Code:
// Using_class_ in_ c++.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
using namespace std;
int main (int argc, char *argv[])
{
Person cg;
char choose[10] = "";
cout<<"\n\t Personnel database 1.0\n";
//system display ("CLS");
//Loop
while (choose [0] != 'q')
{
system ("CLS");
cout<<"\n\t---------------------Main Menu---------------------\n";
cout<<"\n\t| |\n";
cout<<"\n\t| (c) Create person |\n";
cout<<"\n\t| (e) edit information |\n";
cout<<"\n\t| (d) display person |\n";
cout<<"\n\t| (s) Save person |\n";
cout<<"\n\t| (l) Load person |\n";
cout<<"\n\t| (q) quit |\n";
cout<<"\n\t| |\n";
cout<<"\n\t---------------------------------------------------\n\n\t";
cin>>choose;
//system ("CLS");
switch (choose [0])
{
//system ("CLS");
case 'c': cg.createPerson(); break;
case 'e': cg.editPerson(); break;
case 'd': cg.displayPerson(); system ("pause"); break;
case 's': cg.savePerson(); break;
case 'l': cg.loadPerson(); break;
case 'q': cout<<"\n\tExiting main menu..."; break;
default :"\n\tInvalid input!";
}
}
system ("pause");
return 0;
}
Last edited by crisdeveloper; May 14th, 2013 at 10:36 AM.
-
May 14th, 2013, 10:04 AM
#22
Re: Unresolved external symbol
Code:
Error 1 error C2146: syntax error : missing ';' before identifier 'getName' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 3 error C2143: syntax error : missing ';' before 'const' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 6 error C2059: syntax error : ')' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 7 error C2334: unexpected token(s) preceding '{'; skipping apparent function body h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 8 error C2146: syntax error : missing ';' before identifier 'getLocation' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 9 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 10 error C2143: syntax error : missing ';' before 'const' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 11 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 12 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 13 error C2059: syntax error : ')' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 14 error C2334: unexpected token(s) preceding '{'; skipping apparent function body h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 15 error C2146: syntax error : missing ';' before identifier 'getAge' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 16 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 17 error C2143: syntax error : missing ';' before 'const' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 18 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 19 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 20 error C2059: syntax error : ')' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 21 error C2334: unexpected token(s) preceding '{'; skipping apparent function body h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 22 error C2146: syntax error : missing ';' before identifier 'getOccupation' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 23 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 24 error C2143: syntax error : missing ';' before 'const' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 25 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 26 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 27 error C2059: syntax error : ')' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 28 error C2334: unexpected token(s) preceding '{'; skipping apparent function body h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 29 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 22
Error 30 error C2143: syntax error : missing ',' before '&' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 22
Error 31 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 23
Error 32 error C2143: syntax error : missing ',' before '&' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 23
Error 33 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 24
Error 34 error C2143: syntax error : missing ',' before '&' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 24
Error 35 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 25
Error 36 error C2143: syntax error : missing ',' before '&' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 25
Error 37 error C2146: syntax error : missing ';' before identifier 'Name' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 36
Error 38 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 36
Error 39 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 36
Error 40 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 37
Error 41 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 38
Error 42 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 39
Error 43 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 12
Error 44 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 13
Error 45 error C2039: 'Name' : is not a member of 'Person' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 22
Error 46 error C2039: 'Location' : is not a member of 'Person' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 23
Error 47 error C2039: 'Age' : is not a member of 'Person' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 24
Error 48 error C2039: 'Occupation' : is not a member of 'Person' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 25
Error 49 error C2065: 'string' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 56
Error 50 error C2146: syntax error : missing ';' before identifier 'TEMP' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 56
Error 51 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 56
Error 52 error C3861: 'system': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 57
Error 53 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 58
Error 54 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 60
Error 55 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 61
Error 56 error C2228: left of '.ignore' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 61
Error 57 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 62
Error 58 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 62
Error 59 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 62
Error 60 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 63
Error 61 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 65
Error 62 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 66
Error 63 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 66
Error 64 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 66
Error 65 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 67
Error 66 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 69
Error 67 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 70
Error 68 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 70
Error 69 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 70
Error 70 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 71
Error 71 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 73
Error 72 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 74
Error 73 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 74
Error 74 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 74
Error 75 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 75
Error 76 error C3861: 'system': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 82
Error 77 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 83
Error 78 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 84
Error 79 error C3861: 'getName': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 84
Error 80 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 85
Error 81 error C3861: 'getLocation': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 85
Error 82 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 86
Error 83 error C3861: 'getAge': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 86
Error 84 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 87
Error 85 error C3861: 'getOccupation': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 87
Error 86 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 88
Error 87 error C2065: 'ofstream' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 96
Error 88 error C2146: syntax error : missing ';' before identifier 'DATAFILE' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 96
Error 89 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 96
Error 90 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 97
Error 91 error C2228: left of '.open' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 97
Error 92 error C2653: 'ios' : is not a class or namespace name h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 97
Error 93 error C2065: 'out' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 97
Error 94 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 99
Error 95 error C3861: 'getName': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 99
Error 96 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 100
Error 97 error C3861: 'getLocation': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 100
Error 98 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 101
Error 99 error C3861: 'getAge': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 101
Error 100 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 102
Error 101 error C3861: 'getOccupation': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 102
Error 102 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 104
Error 103 error C2228: left of '.close' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 104
Error 104 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 105
Error 105 error C2061: syntax error : identifier 'exception' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 107
Error 106 error C2310: catch handlers must specify one type h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 107
Error 107 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 109
Error 108 error C2317: 'try' block starting on line '95' has no catch handlers h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 111
Error 109 error C2065: 'string' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 118
Error 110 error C2146: syntax error : missing ';' before identifier 'TEMP' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 118
Error 111 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 118
Error 112 error C2065: 'ifstream' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 119
Error 113 error C2146: syntax error : missing ';' before identifier 'DATAFILE' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 119
Error 114 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 119
Error 115 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 120
Error 116 error C2228: left of '.open' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 120
Error 117 error C2653: 'ios' : is not a class or namespace name h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 120
Error 118 error C2065: 'in' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 120
Error 119 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 121
Error 120 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 121
Error 121 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 121
Error 122 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 123
Error 123 error C1003: error count exceeds 100; stopping compilation h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 123
124 IntelliSense: expected a ';' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
125 IntelliSense: class "Person" has no member "createPerson" h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 46
126 IntelliSense: identifier "getLocation" is undefined h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 100
127 IntelliSense: identifier "getAge" is undefined h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 101
128 IntelliSense: identifier "getOccupation" is undefined h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 102
129 IntelliSense: identifier "setName" is undefined h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 123
130 IntelliSense: identifier "setLocation" is undefined h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 126
131 IntelliSense: identifier "setAge" is undefined h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 129
132 IntelliSense: identifier "setOccupation" is undefined h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 132
133 IntelliSense: class "Person" has no member "createPerson" h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\using_class_ in_ c++.cpp 40
-
May 14th, 2013, 10:05 AM
#23
Re: Unresolved external symbol
before break my code this not happened, but for now the out put show this errors, what i´m doing wrong?
-
May 14th, 2013, 10:26 AM
#24
Re: Unresolved external symbol
 Originally Posted by crisdeveloper
before break my code this not happened, but for now the out put show this errors, what i´m doing wrong?
I had a typo in my post:
Code:
string getName () const { return Name; }
string getLocation () const { return Location; }
string getAge () const { return Age; }
string getOccupation () const { return Occupation; }
That is the corrected code.
Also, you didn't answer why you are dynamically allocating memory to create a Person. Why introduce a potential memory leak when you don't have to? Your code now has a memory leak using "new Person()", since you never called delete cg;. But there is no need if you just did this:
Code:
int main (int argc, char *argv[])
{
Person cg;
Then you use
instead of
C++ is not Java or C# or some other language where to create an object, you must use "new". Use "new" when you have no choice but to use it. Otherwise, you open up your code to unnecessary memory leaks if the memory is not handled properly.
With the correction above, there is now no need to call delete (which you forgot to do anyway).
Regards,
Paul McKenzie
Last edited by Paul McKenzie; May 14th, 2013 at 10:31 AM.
-
May 14th, 2013, 10:38 AM
#25
Re: Unresolved external symbol
i make the modifications (check it on my previous post) according you told me, and now the erros is only in Person.h
Code:
Error 1 error C2146: syntax error : missing ';' before identifier 'getName' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Warning 4 warning C4183: 'getName': missing return type; assumed to be a member function returning 'int' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 5 error C2146: syntax error : missing ';' before identifier 'getLocation' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 7 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Warning 8 warning C4183: 'getLocation': missing return type; assumed to be a member function returning 'int' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 9 error C2146: syntax error : missing ';' before identifier 'getAge' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 10 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 11 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Warning 12 warning C4183: 'getAge': missing return type; assumed to be a member function returning 'int' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 13 error C2146: syntax error : missing ';' before identifier 'getOccupation' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 14 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 15 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Warning 16 warning C4183: 'getOccupation': missing return type; assumed to be a member function returning 'int' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 17 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 22
Error 18 error C2143: syntax error : missing ',' before '&' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 22
Error 19 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 23
Error 20 error C2143: syntax error : missing ',' before '&' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 23
Error 21 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 24
Error 22 error C2143: syntax error : missing ',' before '&' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 24
Error 23 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 25
Error 24 error C2143: syntax error : missing ',' before '&' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 25
Error 25 error C2146: syntax error : missing ';' before identifier 'Name' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 36
Error 26 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 36
Error 27 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 36
Error 28 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 37
Error 29 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 38
Error 30 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 39
Error 31 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 12
Error 32 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 13
Error 33 error C2065: 'Name' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 17
Error 34 error C2065: 'Location' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 18
Error 35 error C2065: 'Age' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 19
Error 36 error C2065: 'Occupation' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 20
Error 37 error C2039: 'Name' : is not a member of 'Person' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 22
Error 38 error C2039: 'Location' : is not a member of 'Person' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 23
Error 39 error C2039: 'Age' : is not a member of 'Person' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 24
Error 40 error C2039: 'Occupation' : is not a member of 'Person' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 25
Error 41 error C2065: 'string' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 56
Error 42 error C2146: syntax error : missing ';' before identifier 'TEMP' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 56
Error 43 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 56
Error 44 error C3861: 'system': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 57
Error 45 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 58
Error 46 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 60
Error 47 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 61
Error 48 error C2228: left of '.ignore' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 61
Error 49 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 62
Error 50 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 62
Error 51 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 62
Error 52 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 63
Error 53 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 65
Error 54 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 66
Error 55 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 66
Error 56 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 66
Error 57 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 67
Error 58 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 69
Error 59 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 70
Error 60 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 70
Error 61 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 70
Error 62 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 71
Error 63 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 73
Error 64 error C2065: 'cin' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 74
Error 65 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 74
Error 66 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 74
Error 67 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 75
Error 68 error C3861: 'system': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 82
Error 69 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 83
Error 70 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 84
Error 71 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 85
Error 72 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 86
Error 73 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 87
Error 74 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 88
Error 75 error C2065: 'ofstream' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 96
Error 76 error C2146: syntax error : missing ';' before identifier 'DATAFILE' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 96
Error 77 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 96
Error 78 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 97
Error 79 error C2228: left of '.open' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 97
Error 80 error C2653: 'ios' : is not a class or namespace name h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 97
Error 81 error C2065: 'out' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 97
Error 82 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 99
Error 83 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 100
Error 84 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 101
Error 85 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 102
Error 86 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 104
Error 87 error C2228: left of '.close' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 104
Error 88 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 105
Error 89 error C2061: syntax error : identifier 'exception' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 107
Error 90 error C2310: catch handlers must specify one type h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 107
Error 91 error C2065: 'cout' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 109
Error 92 error C2317: 'try' block starting on line '95' has no catch handlers h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 111
Error 93 error C2065: 'string' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 118
Error 94 error C2146: syntax error : missing ';' before identifier 'TEMP' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 118
Error 95 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 118
Error 96 error C2065: 'ifstream' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 119
Error 97 error C2146: syntax error : missing ';' before identifier 'DATAFILE' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 119
Error 98 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 119
Error 99 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 120
Error 100 error C2228: left of '.open' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 120
Error 101 error C2653: 'ios' : is not a class or namespace name h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 120
Error 102 error C2065: 'in' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 120
Error 103 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 121
Error 104 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 121
Error 105 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 121
Error 106 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 123
Error 107 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 124
Error 108 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 124
Error 109 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 124
Error 110 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 126
Error 111 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 127
Error 112 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 127
Error 113 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 127
Error 114 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 129
Error 115 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 130
Error 116 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 130
Error 117 error C3861: 'getline': identifier not found h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 130
Error 118 error C2065: 'TEMP' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 132
Error 119 error C2065: 'DATAFILE' : undeclared identifier h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 133
Error 120 error C2228: left of '.close' must have class/struct/union h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 133
Error 121 error C2061: syntax error : identifier 'exception' h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 135
Error 122 error C2310: catch handlers must specify one type h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 135
Error 123 error C1003: error count exceeds 100; stopping compilation h:\cry_dev\programming\c++\using_class_ in_ c++\using_class_ in_ c++\person.h 135
-
May 14th, 2013, 10:46 AM
#26
Re: Unresolved external symbol
what it does means?
c++ does not support default-int error
-
May 14th, 2013, 11:01 AM
#27
Re: Unresolved external symbol
Victor Nijegorodov
-
May 14th, 2013, 11:24 AM
#28
Re: Unresolved external symbol
In your stdafx.h, move #include "Person.h" to end of the #includes. Your Person.h file uses cout, string etc which haven't yet been defined.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
May 14th, 2013, 11:25 AM
#29
Re: Unresolved external symbol
i forget to put namespace std, then i fix the error with 'cout´s'. i also should to put stdafx.h in Person.h? or not?
-
May 14th, 2013, 11:29 AM
#30
Re: Unresolved external symbol
okay, also complete the erros is ess then before
Code:
Error 1 error LNK2005: "public: void __thiscall Person::createPerson(void)" (?createPerson@Person@@QAEXXZ) already defined in stdafx.obj H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Using_class_ in_ c++\Using_class_ in_ c++.obj
Error 2 error LNK2005: "public: void __thiscall Person::editPerson(void)" (?editPerson@Person@@QAEXXZ) already defined in stdafx.obj H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Using_class_ in_ c++\Using_class_ in_ c++.obj
Error 3 error LNK2005: "public: void __thiscall Person::displayPerson(void)" (?displayPerson@Person@@QAEXXZ) already defined in stdafx.obj H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Using_class_ in_ c++\Using_class_ in_ c++.obj
Error 4 error LNK2005: "public: void __thiscall Person::savePerson(void)" (?savePerson@Person@@QAEXXZ) already defined in stdafx.obj H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Using_class_ in_ c++\Using_class_ in_ c++.obj
Error 5 error LNK2005: "public: void __thiscall Person::loadPerson(void)" (?loadPerson@Person@@QAEXXZ) already defined in stdafx.obj H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Using_class_ in_ c++\Using_class_ in_ c++.obj
Error 6 error LNK1169: one or more multiply defined symbols found H:\Cry_Dev\Programming\C++\Using_class_ in_ c++\Debug\Using_class_ in_ c++.exe 1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|