GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 04-Oct-2004, 08:45
nkhambal nkhambal is offline
Regular Member
 
Join Date: Jul 2004
Location: CA USA
Posts: 313
nkhambal is a jewel in the roughnkhambal is a jewel in the rough

help to debug complier errors


hi,
Pls help me debug the compiler errors that i am getting while compiling following function

CPP / C++ / C Code:
void ci_changepass()  // Line 693
{
	ccb=first_cmd;
	int params=0;
	char *login="login";
	char *privilege="privilege";
	char *found;
	char *newpass;
	int ln,pr;
	ln=0;
	pr=0;
	if (ccb==NULL)
	{
		return;
	}
	while (ccb!=NULL)
	{
		params++;
				if (params==2)
				{       
					if (strcmp(ccb->cmd,"?")
					{   //Line 715
						printf("login\t\tChange login password\n");
						printf("privilege\t\tChange privilege password\n");
						return;
					}
					if ((found=(char *)strstr(login,ccb->cmd))!=NULL)
					{
						ln=1;
					} else if ((found=(char *)strstr(privilege,ccb->cmd))!=NULL)
					{
						pr=1;
					}
				}
				if (params==3)
					{
						if (strcmp(ccb->cmd,"?")
						{ //Line 731
							printf("<String>\t\tPassword String.Maximum 12 characters\n");
							return;
						} 
						if (strlen(ccb->cmd)>12)
						{
							printf("\nERROR: Maximum password length is 12 characters\n");
							return;
						} 
						
						newpass=(char *)malloc(sizeof(ccb->cmd)+1);
						strcpy(newpass,ccb->cmd);
												
					}
			ccb=ccb->next; //Line 745
			continue;
	}
		
	if (params<2)
	{
		printf("\nERROR: Incomplete Command\n");
		return;
	}
	if (ln)
	{
		strcpy(telpass,newpass);
		free(newpass);
		return;
	} else if (pr)
	{
		strcpy(enablepass,newpass);
		free(newpass);
		return;
	}
	return;
} // Line 765

ccb is declared as
CPP / C++ / C Code:
struct cli_node
{
	char *cmd;
	struct cli_node *next;
};

struct cli_node *ccb;

I am getting following compiler errors. I am marked corresponding start line number.

CPP / C++ / C Code:
ci_func.c: In function `ci_changepass':
ci_func.c:715: parse error before '{' token
ci_func.c:731: parse error before '{' token
ci_func.c: At top level:
ci_func.c:745: conflicting types for `ccb'
ci_func.c:4: previous declaration of `ccb'
ci_func.c:745: invalid type argument of `->'
ci_func.c:745: warning: data definition has no type or storage class
ci_func.c:746: parse error before "continue"
ci_func.c:757: warning: parameter names (without types) in function declaration
ci_func.c:757: warning: data definition has no type or storage class
ci_func.c:758: parse error before "return"
ci_func.c:762: warning: parameter names (without types) in function declaration
ci_func.c:762: warning: data definition has no type or storage class
ci_func.c:763: parse error before "return"

  #2  
Old 04-Oct-2004, 08:51
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,791
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by nkhambal
hi,
Pls help me debug the compiler errors that i am getting while compiling following function



I am getting following compiler errors. I am marked corresponding start line number.

ci_func.c: In function `ci_changepass':
ci_func.c:715: parse error before '{' token

If the compiler says error on line 715 and you are sure that line 715 is OK, start at line 715 and work your way back through previous lines:


CPP / C++ / C Code:
          if (strcmp(ccb->cmd,"?")

Missing right paren, I think.

Regards,

Dave
  #3  
Old 04-Oct-2004, 08:57
nkhambal nkhambal is offline
Regular Member
 
Join Date: Jul 2004
Location: CA USA
Posts: 313
nkhambal is a jewel in the roughnkhambal is a jewel in the rough
oops..is all I have got to say..

Thanks,
  #4  
Old 04-Oct-2004, 09:26
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,791
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by nkhambal
oops..is all I have got to say..

Thanks,

Your error message looks like something from gcc.

What editor are you using? If you use a text editor with syntax highlighting, sometimes this kind of error just jumps out at you. For example with gvim (graphics version of vim), the { on the line after your error was red on my screen. As a matter of fact all subsequent { and } were red.

Other compilers gave the following error messages:

bcc32:
Quote:
If statement missing ) in function ci_changepass()

Microsoft Visual C++:
Quote:
syntax error : missing ' ) ' before '{'

A little more helpful than
Quote:
parse error before '{' token

But none as helpful as those red brackets all over the place.



Regards,

Dave
 
 

Recent GIDBlogPython ebook by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd errors (again) crystalattice C++ Forum 3 15-Aug-2004 21:02
Can't figure out errors crystalattice C++ Forum 3 17-Jul-2004 08:58
Error C2143: syntax error : missing ';' before 'type' small_ticket C Programming Language 6 15-May-2004 12:59
Can somebody look at this and point out any errors to me soulfly C Programming Language 7 31-Mar-2004 10:45
Please help me debug this. rhino1616 C++ Forum 0 17-Dec-2003 02:39

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:39.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.