![]() |
hey, stupid question but...
I was wondering if anyone could give me any help. I keep coming up with an error when I try to use this function definition. I haven't declared the function in anywhere else other then this, and it is ahead of any calls to the function so I let it be its own prototype.
Code:
int intMax(int x, int y) |
Re: hey, stupid question but...
Hmm, I don't do C much, but have you tried declaring a function prototype at the start of the code?
Code:
// Include files |
Re: hey, stupid question but...
thanks for the quick response! I just tried prototyping it, but no luck. The exact error i'm getting looks like this
Code:
Clean: Deleting intermediary and output files. |
Re: hey, stupid question but...
Quote:
Have you declared any globals x or y already? |
Re: hey, stupid question but...
I don't want to post the entire code (our homebrew mecanum drive code) but at the top of the post where I comment by the bracket is line 228. thanks for your help :)
|
Re: hey, stupid question but...
Since I can't see the whole code, and I won't know what functions might already be predefined, have you tried renaming the function to something other than intMax? Try just qwerty or something miscellaneous for now to see if the function might already have been reserved for something.
|
Re: hey, stupid question but...
Look closely at the lines preceding the one identified as causing the error. I'm guessing you have a missing semicolon or close brace somewhere before your intMax function definition.
|
Re: hey, stupid question but...
Check around in your code. It is likely that the syntax error is actually entirely unrelated to that section of the code. Looks like you might have a missing brace or semicolon somewhere.
|
Re: hey, stupid question but...
Thank you for calling the Department of Redundancy Agency.
Have you checked for a missing semicolon or closing brace? ;) |
Re: hey, stupid question but...
This may or may not be way off, but I remember reading somewhere that the C18 compiler has trouble with filenames longer than 64 characters. It wouldn't compile some code that I had in the My Documents folder once, so I put all the code in a folder in the root c: directory. Worked fine after that.
Just something I remember, may or may not help you! Hope you get it figured out. Best of luck, -Chris |
Re: hey, stupid question but...
Quote:
|
Re: hey, stupid question but...
i could be wrong...
but you declared the integer variable "max" in the function. try putting "int max;" in your first line of code along with all your other variable declarations and then in the function... "max = ..." |
Re: hey, stupid question but...
Quote:
|
Re: hey, stupid question but...
Are you just trying to build the code or is this error occurring when you download to the RC? If the former, I'd suggest heeding prior suggestions to check for a missing semicolon and/or brace. If the latter, I would check if you may be running out of program memory on the processor. This isn't as much of a problem with 2006 and 2007 RCs as it is with 2005 and earlier RCs, since they increased the code space for 2006. I doubt this is the problem, but my team has run into memory issues in the past.
|
Re: hey, stupid question but...
Quote:
but ive made the mistake of using function-level variable outside the function. Its probably not the problem, but its worth a try. |
Re: hey, stupid question but...
it probably isn't prototyping since it is a syntax error. My guess is that it sometimes tells you there's an error a line or two after the actual error. It may be a problem with the int intmax(int x, int y) line. try changing a couple things to see if that's the problem.
|
Re: hey, stupid question but...
Hey you who had the problem, are you still with us?
Why do you even have 'max'? Couldnt you just use this? Code:
int intMax(int x, int y) |
| All times are GMT -5. The time now is 23:56. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi