LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-14-2006, 06:15 PM   #1
xxrsc
LQ Newbie
 
Registered: Nov 2005
Posts: 11

Rep: Reputation: 0
Error: invalid lvalue in assignment


I'm trying to compile irmp3-v0.5.6 but I have the following error.

irmp3mod.c: In function ‘mod_sendmsg’:
irmp3mod.c:103: error: invalid lvalue in assignment
make[2]: *** [irmp3mod.o] Error 1

Here's where I think the problem is:


Code:
// append message to queue
	for (m=mod_msgs; m && m->next; m=m->next);
	m ? m->next : mod_msgs = newmsg;

Here's the function:
Code:
void mod_sendmsg (int msgtype, char *msg)
{
	mod_message_t *newmsg, *m;
	log_printf(LOG_NOISYDEBUG,"CORE: message %s type %d sent",msg,msgtype);
	if(answer_head) { // we are in a query
		// the action has to be taken immediatly, so transform this to a query call
		// however, we don't care about the answer
		free_message(mod_query(msgtype,msg));
		// create new message entry
		newmsg = malloc(sizeof(mod_message_t));
		if (!newmsg) {
			return;
		}
		newmsg->msg = malloc(strlen(msg)+1);
		if (!newmsg->msg) {
			free(newmsg);
			return;
		}
		newmsg->msgtype = msgtype;
		strcpy(newmsg->msg, msg);
		newmsg->next = NULL;
		answer_head->next = newmsg;
		answer_head = newmsg;
		return;
	}

	// create new message entry
	newmsg = malloc(sizeof(mod_message_t));
	if (!newmsg)
		return;
	newmsg->msg = malloc(strlen(msg)+1);
	if (!newmsg->msg) {
		free(newmsg);
		return;
	}
	newmsg->msgtype = msgtype;
	strcpy(newmsg->msg, msg);
	newmsg->next = NULL;

	// append message to queue
	for (m=mod_msgs; m && m->next; m=m->next);
	m ? m->next : mod_msgs = newmsg;
}
I've tried using and older version of gcc but then I get a bunch of other errors.
 
Old 08-17-2006, 01:43 PM   #2
helmut_hed
Member
 
Registered: Jul 2003
Location: San Francisco, CA, USA
Distribution: Kubuntu Hardy
Posts: 103

Rep: Reputation: 15
That code is maybe a little too "clever"

I would first look at the type of m->next and mod_msgs and make sure they are still the same as the type of newmsg. If they are, I would try rewriting this line:

m ? m->next : mod_msgs = newmsg;

as this:

if (m) {
m->next = newmsg;
}
else {
mod_msgs = newmsg;
}

which should be equivalent. "invalid lvalue" means the left-hand-side of an assignment (the lvalue) is messed up. It could be a gcc version issue as you surmised.

Good luck,
Jeff
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid Argument Error ahmedb72 Red Hat 1 02-25-2006 07:52 AM
How do I fix this assignment problem C++ compiler error in GCC? Erik_the_Red Programming 4 07-12-2005 09:36 AM
wait_event_interruptible - invalid lvalue in unary `&' 7.e.Q Programming 4 11-08-2004 02:00 AM
c++: ERROR: Invalid indirection ashirazi Programming 0 08-22-2004 12:09 PM
installation error: Error mounting sda1: Invalid Argument sadirmata Linux - Newbie 1 01-29-2002 02:28 AM


All times are GMT -5. The time now is 08:09 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration