Compiler errors: no comprendo

This is a discussion on Compiler errors: no comprendo within the C++ Programming forums, part of the General Programming Boards category; This boot-up password program compiles and runs with MSVC++. Now I want to compile it using GCC (DJGPP), and I ...

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    891

    Compiler errors: no comprendo

    This boot-up password program compiles and runs with MSVC++. Now I want to compile it using GCC (DJGPP), and I get this error which I don't understand:

    password.cpp: In function 'int main(...)'
    password.cpp: 48: implicit declaration of function 'int strcmpi(...)'

    What? Implicit? Understood but not stated? Does anyone know what is meant by this error? I belive the same error applies to my every other call of 'strcmpi()', if I were to remove the one mentioned.

    Here is the main function:
    Code:
    int main()
    {
    	char* password = new char[50];
    	char* response = new char[50];
    	bool ChangePassword = false;
    	bool bypass = false;
    	ifstream ReadPasswordFile;
    	ofstream WritePasswordFile;
    	ReadPasswordFile.open("c:\\password.psw");
    
    	system("cls");
    
    	if(ReadPasswordFile.fail())
    	{
    		cout << "Could not open password file: using default password" << endl;
    		strcpy(password,"ishboo");
    	}
    	else
    	{
    		ReadPasswordFile.getline(password,50);
    		if(password[0] == (char)141)
    		{
    			ReadPasswordFile.close();
    			return 0;
    		}
    	}
    	ReadPasswordFile.close();
    
    	while(1)
    	{
    		cout << "What's the password?" << endl;
    		//PASSWORD ENTRY PUMP (DISPLAYS ONLY '*')
    		PasswordPump(response);
    		//END PASSWORD ENTRY PUMP (DISPLAYS ONLY '*')
    		if(!strcmpi(response,password))
    		{
    			cout << "Thanks youz!";
    			for(int x = 12; x < strlen(response); x++)
    				putch(32);//space
    			putch('\n');
    			if(ChangePassword)
    			{
    				while(1)
    				{
    					cout << "\nInput new password: ";
    					PasswordPump(password);
    					cout << endl;
    					cout << "Plese retype: ";
    					PasswordPump(response);
    					cout << endl;
    					if(!strcmpi(password,response))
    					{
    						WritePasswordFile.open("c:\\password.psw");
    						if(!WritePasswordFile.fail())//if it succeeded
    							WritePasswordFile << password;
    						else
    						{
    							cout << "Could not open \"c:\\password.psw\"." << endl;
    							break;
    						}
    						cout << "Password change complete!" << endl;
    						WritePasswordFile.close();
    						break;
    					}
    					else
    					{
    						cout << "Those two are inconsistant!" << endl;
    					}
    				}
    			}
    			if(bypass)
    			{
    				WritePasswordFile.open("c:\\password.psw");
    				if(!WritePasswordFile.fail())//if it succeeded
    					WritePasswordFile << (char)141;
    				else
    				{
    					cout << "Could not open \"c:\\password.psw\"." << endl;
    					break;
    				}
    				cout << "Password bypassed!" << endl;
    				WritePasswordFile.close();
    			}
    
    			break;
    		}
    		else if(!strcmpi(response,"change password") || !strcmpi(response,"changepassword"))
    		{
    			ChangePassword = true;
    			wrong(response);
    		}
    		else if(!strcmpi(response,"bypass"))
    		{
    			bypass = true;
    			wrong(response);
    		}
    		else
    			wrong(response);
    	}
    
    	//system("cls");
    	return 0;
    }
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    According to this article strcmpi is not supported by ansi c++. I bet if you use strcmp (without the 'i') your code will compile just fine.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  3. bloodshed compiler errors
    By nerore in forum C++ Programming
    Replies: 5
    Last Post: 04-17-2004, 02:37 PM
  4. How to resolve linking errors?
    By m712 in forum C++ Programming
    Replies: 3
    Last Post: 11-03-2002, 09:17 PM
  5. Compiler errors
    By BellosX in forum C Programming
    Replies: 2
    Last Post: 09-21-2001, 03:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21