List of errors

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
borntoown
Posts: 58
Joined: 14 Nov 2010, 16:58

List of errors

Post by borntoown »

Is there any list for errors that i can get in my NXC code?

*update*

The above question seems hard, ok. What about:
What are the common errors people get in their NXC codes?
B2O productions are the best for the best.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: List of errors

Post by afanofosc »

I'm not sure what you are looking for. There are a lot of different compiler errors you can get if your code is not understood by the compiler. Which errors you get depends on what you put in your source code. I have not numbered them or collected them into a documented list that I could give you, unfortunately.

You can also get runtime errors when your program runs on the NXT.

In C compilers it is often the case that if you have a missing semicolon or some other problem in your code the compiler will spit out a bunch of errors messages even though there really is only one problem. That's because the compiler and your code wind up being out of sync. Try to focus on just the first error message and figure out what it is complaining about. It is often fairly easy to figure out though it can, at times, be a bit confusing.

Common errors that I see include

1. missing semicolons
2. case sensitivity problems
3. Unsupported standard C syntax problems (e.g., trying to use pointers)
4. Non-standard C syntax problem (e.g., array parameter types in user-defined functions)
5. Passing C expressions into API functions that are defined as preprocessor macros which emit NBC assembler
6. Trying to use functions that require the enhanced NBC/NXC firmware or a 2.0 firmware when targetting the standard firmware or a 1.0x firmware.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
dudmaster
Posts: 171
Joined: 06 Oct 2010, 02:38
Location: Texas, Santa Fe
Contact:

Re: List of errors

Post by dudmaster »

I think what he is looking for is the "File Error -" code meanings. :?
2Labz.com, My Website
borntoown
Posts: 58
Joined: 14 Nov 2010, 16:58

Re: List of errors

Post by borntoown »

Thanks. Actually, what i was looking for, is a list of errors i might get when downloading my program to my NXT, because when i do, i get alot of errors, and some of them i don't know what they mean (don't ask what are they, because i don't remember). By the way, why when it gives an error, its says "line 18 (for example), while my program contains only 15 (for example)?

If there is no list available, please don't reply any more on this topic, and i will delete it. Thanks again.
B2O productions are the best for the best.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: List of errors

Post by HaWe »

I don't know if this is of interest to you, but that's a error code that I once got - though I don't know if it's still valid:

Code: Select all

#define NO_ERR        0

//Fatal errors
//0xFF Bad arguments
//0xFE Illegal bytecode instruction
//0xFE Illegal bytecode instruction
//0xFD Mal-formed file contents
//0xFB Insufficient memory available
//0xFA Someone passed us a bad pointer!
#define ERR_ARG      -1
#define ERR_INSTR    -2
#define ERR_FILE     -3
#define ERR_VER      -4
#define ERR_MEM      -5
#define ERR_BAD_PTR  -6

//General errors
//0xF0 Bad input or output port specified
//0xEF Attempted to access invalid field of a structure
//0xEE Illegal queue ID specified
//0xED Illegal size specified
//0xEC No active program
#define ERR_INVALID_PORT   -16
#define ERR_INVALID_FIELD  -17
#define ERR_INVALID_QUEUE  -18
#define ERR_INVALID_SIZE   -19
#define ERR_NO_PROG        -20

//Communications specific errors
//0xE0 Specified channel/connection not configured or busy
//0xDF Specified channel/connection is not valid
//0xDE No room in comm buffer
//0xDD Something went wrong on the communications bus
#define ERR_COMM_CHAN_NOT_READY -32
#define ERR_COMM_CHAN_INVALID   -33
#define ERR_COMM_BUFFER_FULL    -34
#define ERR_COMM_BUS_ERR        -35

//Remote control (direct commands) errors
//0xC0 Data contains out-of-range values
//0xBF Clearly insane packet
//0xBE Unknown command opcode
//0xBD Request failed (i.e. specified file not found)
#define ERR_RC_ILLEGAL_VAL -64
#define ERR_RC_BAD_PACKET  -65
#define ERR_RC_UNKNOWN_CMD -66
#define ERR_RC_FAILED      -67 
HTH!
physics-matt
Posts: 76
Joined: 29 Sep 2010, 06:57

Re: List of errors

Post by physics-matt »

borntoown wrote:i get alot of errors, and some of them i don't know what they mean
Some examples would help. One piece of advice I would give is: only focus on the first error you get. The reason is that many subsequent errors may be caused by the first one. For instance, if I remove the semi-colon at the end of line 44 in the code I am currently working on I get:

Code: Select all

line 44: Error: ';' expected
line 44: Error: Invalid assignment
line 45: Error: ';' expected
line 49: Error: '}' expected
line 64: Error: ';' expected
The actual error in my code is on line 44, but I get a load of errors reported on other lines that were caused by the compiler not knowing what to do next. This isn't anything special about NXC either, most compilers will do something like this.

Fix the first error reported, then re-compile and see how many are left. Don't attempt to fix all your errors at once.

Hope that helps.

Matt
borntoown
Posts: 58
Joined: 14 Nov 2010, 16:58

Re: List of errors

Post by borntoown »

Well, i think i'm going so fast while im not learning nothing at all...

I saw alot of stuff in NXC and i dont know what to do now... I want to program in NXC because i heard it doesnt take much space like NXT-G so i can make my large project ...
B2O productions are the best for the best.
noeyewar
Posts: 12
Joined: 30 Oct 2010, 15:51

Re: List of errors

Post by noeyewar »

I am not sure what your mean with your last reply, but you do not think you are learning anything? Believe me, you are! But learning to program requires a bit of patience. It requires you to think in a certain way and understand what is actually going on. It is also the reason why no one can give you a complete list of errors and why these occurs. It is like asking for a complete list of errors you could make while writing or speaking a real language like English. People could surely point out a few mistakes often made, but you can put your sentences (and programs) together in infinitely many ways.

But stay at it, and frustration will be followed by excitement! I guess what you really need is a programming book/tutorial targeted at beginners. I can really recommend this free online book:
http://math.hws.edu/javanotes/c2/index.html

It is teaching you a programming language called java but the principles you are learning (at least in the first chapters) can be directly transferred to nxc (or almost any other programming language). Read (and understand) chapter 2-4 and make the exercises in the book (they are fun and starts off really easy and gets harder and harder).

To create and compile your java programs you can use eclipse, look at this simple guide:
http://www.javaprogrammingforums.com/ja ... ation.html

And when your done with these chapters get back to nxc and you will suddenly understand a lot better what is going on. Then programming starts to be really fun.

Good luck :-)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: List of errors

Post by HaWe »

I definetely don't agree to your suggestion concerning java. Already the installation of Java cost you decades of your live, not to talk about the program development where you have to struggle with implementations and extensions and instances and classes and methods before you have written one single line of your own code.
But there is a NXC tutorial and a NXC guide and a built-in NXC help, in most cases (especially for a beginner) this should help.
And then there are lots of books about NXC ( I myself once started with a book of Dave Baum about NQC, that was excellent, and nowadays you can purchase books e.g. written by John Hansen)
noeyewar
Posts: 12
Joined: 30 Oct 2010, 15:51

Re: List of errors

Post by noeyewar »

You might be right. I just took a look at the nxc tutorial and it seams to be quite good. Maybe suggesting learning java is a bit overkill, but i would like to point out that the book above IS a great place to learn programming. Not so much because of the choice of language but because it is a well written and includes great exercises. But in general you are probably right.

I do not hope I confused the kid more than he already was. It was not my intention :oops:
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests