Jump to content
Sign in to follow this  
evandude

what is wrong here?

Recommended Posts

every line of code after a certain point in my program gives an error. it is all valid code, as there are several sections in a row that are just several copies of the same thing, but with different variables.  everything compiles just fine up to this certain point, and then every line it encounters generates an error.  if i put '//' before any of the lines generating an error, it just gives an error for the next line it encounters...  no matter how many lines I turn into comments, it keeps giving errors on the next ones.  

the errors it gives are either:

general error (in the case of brackets, else statements, etc)

redefinition error (when trying to set a variable equal to a number, ie- a=0;)

or error in function definition (when trying to call a function, ie- delay_ms(100);

 

I am using the program in the evaluation period, is there some sort of code limit that I have hit that is causing this?

I'm using 5.1.1 here, I have also tried it with 5.1.2, that didn't work either.

 

just for an example, here is the section of code that it starts screwing up on:

if(recock[1]>recock[6])
     {
    	 recock[1]=recock[1]-recock[6];
    	 maketone(100,1);
    	 delay_ms(200);
    	 delay_ms(200);
     }
     else
     {
    	 recock[1]=0;
    	 recock[0]=recock[0]-1;
    	 maketone(100,1);
    	 delay_ms(200);
    	 delay_ms(200);
     }

 

here are the errors:

 

line  352: General error

line  353: General error

line  354: Redefinition of 'recock'

 

Line 352 is the line with a bracket on it, above the else statement.

Share this post


Link to post
Share on other sites
Guest Pavel

Please try to compile your code with the compiler version 5.1.2 There is a chance that the compiler you use reports errors on wrong lines. The new compiler has this problem fixed so you can get more precise error location.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

I have encountered problems similar to the one you describe,

and it usually turned out that the problem was really

somewhere before the indicated error line.  That is why

commenting lines simply moves the indicated error line.

 

The compiler reports the error where it does because it is

the first place that it _notices_ the error, not always on the

line that is actually causing the error.

 

Usually it is some difficult-to-find, silly mistake that I made.

 

One place to look is inside any "asm{}" blocks that you have.

I have sometimes had syntax problems inside these.

 

I don't know how long this program is, but I suggest printing

it out and go over it very carefully, line-by-line.  If you are

using c++ classes, and/or multiple source files it gets a little

more difficult, but the process is the same...

 

BTW: I don't know of anything in the evaluation version that

       would be causing your problem.

 

P.S.  If you want me to look over the code and look for

      problems you can send it to JJHawg@aol.com

 

P.P.S. You might also try running it through a LINT program...

        I never use lint, but there must be some freeware

        out there you could try.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...