Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8713049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:15:04+00:00 2026-06-13T05:15:04+00:00

There is an error when i try to compile and im not sure whats

  • 0

There is an error when i try to compile and im not sure whats wrong with it.
This is a program which authencate username and password with textfile, seperated with “;” delimeter in a single textfile.
The error is quite long.

/tmp/ccgs7RYV.o: In function 'Employee::Employee()':
main2.cpp:(.text+0xa5): undefined reference to 'Employee::authenticate(std::basic_string, std::allocator>, std::basic_string, std::allocator>)'
/tmp/ccgs7RYV.o: In function `Employee::Employee()':
main2.cpp:(.text+0x231): undefined reference to 'Employee::authenticate(std::basic_string, std::allocator>, std::basic_string, std::allocator>)'
collect2: ld returned 1 exit status
#include<iostream>
#include<string>
#include <fstream>

using namespace std;

class Employee
{
public:
Employee();
bool authenticate(string, string);
};

Employee::Employee()
{
    string username, password;
    cout << "Username: ";
    cin >> username;

    cout << "Password: ";
    cin >> password;

    if (authenticate(username, password) == true)
        cout << "Sucess" << endl;
    else
        cout << "fail" << endl; 
}

bool authenticate(string username, string password) 
{
    std::ifstream file("login.txt");
    std::string fusername, fpassword;

    while (!file.fail()) 
    {
        std::getline(file, fusername, ';'); // use ; as delimiter
        std::getline(file, fpassword); // use line end as delimiter
        // remember - delimiter readed from input but not added to output

        if (fusername == username && fpassword == password)
            return true;
    }

    return false;
}


int main()
{
    Employee();
    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:15:05+00:00Added an answer on June 13, 2026 at 5:15 am
    bool Employee::authenticate(string username, string password) {
    std::ifstream file("login.txt");
    std::string fusername, fpassword;
    
    while (!file.fail()) {
        std::getline(file, fusername, ';'); // use ; as delimiter
        std::getline(file, fpassword); // use line end as delimiter
        // remember - delimiter readed from input but not added to output
        if (fusername == username && fpassword == password)
            return true;
    }
    

    You need to use the scope resolution operator. You were just missing that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found plenty of information out there about this error: 'ERROR: Could not
When we try to create a view within a funcion we get ERROR: there
Today I got a project written in PHP. There's an error when I try
Is there any way to turn the damned error provider off when i try
Recently I came across this error in my WCF trace: There was an error
I am fairly new to SQL, so not sure if this is just a
I am not sure why I am getting an "error C2660: 'SubClass::Data' : function
sure there's a simple solution to this, but can't for the life of me
I'm sure there is an answer to this somewhere but I'm clearly using the
I am not sure if I am doing this right. I have a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.