473,396 Members | 1,724 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,396 software developers and data experts.

error: non-lvalue in assignment

8
Hi Everybody

the compiler throws an error when it runs this function in my code, I couldn't figure out what is wrong with my code, please assist me, thanks :).

Expand|Select|Wrap|Line Numbers
  1. void SMAC::IncreaseCW() {
  2. init rI=2;
  3. DATA_CW=DATA_CW*rI;
  4. double cw = (Random::random() % DATA_CW) * slotTime_sec_;
  5. mhCS_.sched(CLKTICK2SEC(difs_) + cw);
  6.  
Expand|Select|Wrap|Line Numbers
  1. mac/smac.cc: In member function `void SMAC::IncreaseCW()':
  2. mac/smac.cc:463: error: non-lvalue in assignment
  3.  
May 12 '09 #1
10 10458
Banfa
9,065 Expert Mod 8TB
init rI=2;
Did you mean int?
May 12 '09 #2
JosAH
11,448 Expert 8TB
@Banfa
DATA_CW suggests to be a macro name ... who knows?

kind regards,

Jos
May 12 '09 #3
muby
8
sorry folks, i meant
int rI = 2;
im still facing the same error, any help? thx :)
May 12 '09 #4
scruggsy
147 100+
Your error says line 463. Which of those lines is 463?

You have an assignment involving something called DATA_CW, but you didn't post the code which defines DATA_CW.

More info == more help.
May 12 '09 #5
JosAH
11,448 Expert 8TB
@muby
Did you read the error message and did you check the line your compiler complained about? Learn how to read error messages; it'll be a lot faster than posting here everytime you see one.

kind regards,

Jos
May 12 '09 #6
muby
8
Thanks for your reply, the line where im getting error is shown below,
I defined DATA_CW in header file as
#define DATA_CW 63
Expand|Select|Wrap|Line Numbers
  1. # void SMAC::IncreaseCW() {
  2. # int rI=2;
  3. # DATA_CW=DATA_CW*rI; # error is in this line (line 463)
  4. # double cw = (Random::random() % DATA_CW) * slotTime_sec_;
  5. # mhCS_.sched(CLKTICK2SEC(difs_) + cw);
  6. }
May 12 '09 #7
newb16
687 512MB
After preprocessing it's expanded to
63 = 63*2;

Left part is a number here, you can't assign to numbers. What are you trying to do?
May 12 '09 #8
muby
8

IncreaseCW
should increases the value of DATA_CW by doubling the old value of DATA_CW, and assigne the new value back to DATA_CW. this new value will be used in other functions.

I changed it as shown below, but im still getting the same error.

Expand|Select|Wrap|Line Numbers
  1. void SMAC::IncreaseCW() {
  2. int DATA_CW_new;
  3. DATA_CW_new = (DATA_CW*rateincrease);
  4. DATA_CW = DATA_CW_new;
  5. double cw = (Random::random() % DATA_CW) * slotTime_sec_;
  6. mhCS_.sched(CLKTICK2SEC(difs_) + cw);
  7. }
May 12 '09 #9
scruggsy
147 100+
Read newb16's post again.
DATA_CW is a macro, not a variable. It is replaced by the compiler with '63' wherever it occurs in your code. You cannot assign to it. Use a variable.
May 12 '09 #10
muby
8
Thanks alot, that fixed my error :)
May 12 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
1
by: Sean Abrahams | last post by:
The following is a reprint of a message I sent to the tutor list a long time ago, that I haven't gotten around to discussing with anyone else and failed to hear a reply on the tutor list. Hoping...
4
by: muser | last post by:
Can anyone run this program through their compiler or if they can see a logical error please point it out. I have my tutor working on it at the moment but I would rather a less ambigious response...
0
by: Morten Gulbrandsen | last post by:
mysql> USE company; Database changed mysql> mysql> DROP TABLE IF EXISTS EMPLOYEE; -------------- DROP TABLE IF EXISTS EMPLOYEE -------------- Query OK, 0 rows affected (0.00 sec)
13
by: a.zeevi | last post by:
free() multiple allocation error in C ==================================== Hi! I have written a program in C on PC with Windows 2000 in a Visual C environment. I have an error in freeing...
22
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of...
2
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my...
1
by: Alexander Higgins | last post by:
>>Thanks for the response.... Point Taken but this is not the case. Thus, if a person writes a text file on her or his computer and does not use UNICODE to save it, the current code page is...
13
by: Albert | last post by:
Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()" I don't get it - I've included <tcconio.h>. (strange why...
2
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.