473,406 Members | 2,705 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,406 software developers and data experts.

Password program problem...

I've been trying to get a login program to work for quite some time now
but for some reason I get the same error. I have chosen a small peice
of code that only gives me One error
#include <unistd.h>
#include <stdlib.h>
#include <iostream>

char * getpass(const char *prompt);

using namespace std;
int main()
{
char *password = getpass("Password: ");
return 0;
}
and the error is:
[Linker error] undefined reference to `getpass(char const*)'

P.S. My compiler is Dev-cpp
-Thanks in advance;

May 10 '06 #1
4 3497
vo*******@yahoo.com wrote:
I've been trying to get a login program to work for quite some time now
but for some reason I get the same error. I have chosen a small peice
of code that only gives me One error
#include <unistd.h>
#include <stdlib.h>
#include <iostream>

char * getpass(const char *prompt);

using namespace std;
int main()
{
char *password = getpass("Password: ");
return 0;
}
and the error is:
[Linker error] undefined reference to `getpass(char const*)'

P.S. My compiler is Dev-cpp
-Thanks in advance;

getpass isn't part of the C++ standard library. As far as I can tell,
it also is not part of any popular standard (POSIX, SUS3, etc). It
appears on my machine, but the first line of the man page is:
"This function is obsolete. Do not use it."

--
Alan Johnson
May 10 '06 #2
vo*******@yahoo.com wrote:
I've been trying to get a login program to work for quite some time now
but for some reason I get the same error. I have chosen a small peice
of code that only gives me One error

#include <unistd.h>
#include <stdlib.h>
#include <iostream>

char * getpass(const char *prompt);
Umm.. where's the definition for this function? That function should
have a body somewhere.
using namespace std;
int main()
{
char *password = getpass("Password: ");
return 0;
}
and the error is:
[Linker error] undefined reference to `getpass(char const*)'

P.S. My compiler is Dev-cpp


Dev-c++ is an IDE, not a compiler.
Jonathan

May 10 '06 #3
vo*******@yahoo.com wrote:
I've been trying to get a login program to work for quite some time now
but for some reason I get the same error. I have chosen a small peice
of code that only gives me One error
#include <unistd.h>
#include <stdlib.h>
#include <iostream>

char * getpass(const char *prompt);

If you have to provide a prototype for a function that you think is in a
standard header (probably unistd.h in this case), then most likely the
function isn't in your platforms standard libraries.

--
Ian Collins.
May 10 '06 #4
Well actually, it does contain constants and types needed for POSIX
compatibility but is deprecated and is not std.

Seeing as how it doesn't exist anymore (or shouldn't) you need to roll
your own. The compiler understands your declaration but can't find your
definition so it spits out that error. Your error happens whennever
there is a declaration but no definition.

May 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Larry Blake | last post by:
I have a VB6 program that uses ADO to an AS400 running v4r5. The following code works fine on a Windows NT 4 machine, but prompts me for a user and password on Windows 2000. The Win2000 machine has...
3
by: Whitey | last post by:
I have a password secured database. After the password is entered the user has a form that I created that allows them to search the database and retrieve information. The problem is that the...
0
by: com | last post by:
MS Access 2000 Password Recoverer 4.2 Screenshot - Soft30.com MS Access 2000 Password Recoverer will display the password to a MS Access database (*.mdb). This program works for MS Access files...
5
by: Crayon Coco | last post by:
Hi, I just want to check is it OK to set the password for ASPNET of my web server, will it impact my program
0
by: federico | last post by:
Hello, how can I make a program respond to another program's input request? For example, this code: Process.Start("unrar.exe", "e D:\temp\key.rar D:temp2") SendKeys.SendWait("test~") will...
7
by: Stanav | last post by:
Hello all, I'm writing a program that interacts with databases. I want that when the users run this program, they can view the data as much as they want. But if they make any changes to the data...
4
by: James | last post by:
I succesfully pass username , domain and password via this function (taken from MSDN) Private Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal lpszUsername As , _ ByVal lpszDomain As...
9
by: kwindham | last post by:
This program doesn't seem like it should be too hard, but I cannot figure it out. Here is the assignment: Password Verifier - Write a program to verify passwords, satisfying the following...
30
by: diane | last post by:
I've got an application running with table-based security: i capture the user's windows login with fOsusername, then have them enter a password checked against their username/login in my own table....
7
by: Thana1995 | last post by:
Write a program that asks the user to give a two-character password(defined by constants within the program). the program should then test the validity of the password. if it is incorrect after three...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.