'What can cause an LNK2019 Error when building a project?
I built my program with wxWidgets Library and OpenCV. I set up my project by first including wxWidgets property file as follows:
Property manager where property file was set:
I then set OpenCV by targeting the include a library directory as well as added the Additional dependency opencv_world455d.lib. But for wxWidgets I only added the property page only
This is the code of on of the classes the return the error:
'''class User : public wxSocketClient{public:
//constructors
User();
User(wxSocketFlags flags);
//Data accessors
void SetUserName(wxString& name) { name = username; }
wxString GetUserName() { return username; }
void SetUserSurname(wxString& surname) { surname = usersurname; }
wxString GetUserSurname() { return usersurname; }
void SetUserNumber(wxString& number) { number = usernumber; }
wxString GetUserNumber() { return usernumber; }
void SetUserPassword(wxString& password) { password = userpassword; }
wxString& GetUserPassword() { return userpassword; }
void SetUserNationality(wxString& nation) { nation = usernationality; }
wxString GetUserNationality() { return usernationality; }
void SetUserDateofbirth(wxString& date) { date = userdateofbirth; }
wxString GetUserDateofbirth() { return userdateofbirth; }
void SetUserEmail(wxString& email) { email = useremail; }
wxString& GetUserEmail() { return useremail; }
void SetEmailPassword(wxString& emailpassword) { emailpassword = useremailpassword; }
wxString GetEmailPassword() { return useremailpassword; }
wxString& username;
wxString& usersurname;
wxString& usernumber;
wxString& userpassword;
wxString& usernationality;
wxString& userdateofbirth;
wxString& useremail;
wxString& useremailpassword;
//user has this data if he has become a teacher
wxString& teachername;
wxString& teachersurname;
wxString& teacheridno;
wxString& teacheremail;
wxString& teachercv;
wxString& teacherID;
void SetTeachername(wxString& name) { name = teachername; }
wxString GetTeachername() { return teachername; }
void SetTeachersurname(wxString& surname) { surname = teachersurname; }
wxString GetTeachersurname() { return teachersurname; }
void SetTeacheridnumber(wxString& IDnumber) { IDnumber = teacheridno; }
wxString GetTeacheridnumber() { return teacheridno; }
void SetTeacherEmail(wxString& email) { email = teacheremail; }
wxString GetTeacherEmail() { return teacheremail; }
void SetTeacherCV(wxString& cv) { cv = teachercv; }
wxString GetTeacherCV() { return teachercv; }
void SetTeacherID(wxString& ID) { ID = teacherID; }
wxString GetTeacherID() { return teacherID; }
//Student data
wxString& studentname;
wxString& studentsurname;
wxString& studentage;
wxString& studentAddress;
wxString& City;
wxString& dateofbirth;
void SetStudentname(wxString& name) { name = studentname; }
wxString GetStudentname() { return studentname; }
void SetStudentsurname(wxString& surname) { surname = studentsurname; }
wxString GetStudentsurname() { return studentsurname; }
void SetStudentage(wxString& age) { age = studentage; }
wxString GetStudentage() { return studentage; }
bool GetMessage(wxNotificationMessage* messge) { return messge; }
//Get the account created
PersonalProfile* Profile;
wxSchoolPage* SchoolProfile;
void SetChannelAccount(PersonalProfile* profile) { profile = Profile; }
bool GetChannelAccount()
{
return Profile->Show();
}
void SetSchoolAccount(wxSchoolPage* schoolprofile) { schoolprofile = SchoolProfile; }
bool GetSchoolAccount()
{
return SchoolProfile->Show();
}};'''
This is the implementation:
'''void Frame::OnConnectToServer(wxCommandEvent& event){wxIPV4address addr;addr.IPV6; addr.Hostname(); addr.Service();
wxSocketServer* server = new wxSocketServer(addr, wxSOCKET_SERVER | wxSOCKET_CONNECTION);
User* client = new User(wxSOCKET_CLIENT | wxSOCKET_CONNECTION);
client->Connect(addr, true);
client->SetTimeout(60);}'''
I build the first time and got the linker error that goes as follows:
1>SchoolHub.obj : error LNK2019: unresolved external symbol "public: __cdecl User::User(int)" (??0User@@QEAA@H@Z) referenced in function "public: void __cdecl Frame::OnConnectToServer(class wxCommandEvent &)" (?OnConnectToServer@Frame@@QEAAXAEAVwxCommandEvent@@@Z)
A went to the systems setting and changed from console to window:
Link systems settings:
What might be the problem?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
