Hi David, > Welcome to GCC! GCC is a "big iron" compiler front end and all > programs written for full OS's require a return code for main(). AVR is > a custom backend of the compiler so main must be of type int for > compatibility reasons. Also, I highly recommend that you compile your code using -Wall. This will cause the compiler to point out lots of little things that often hangup the beginner. Personally, I like my code to compile error and warning free with the following set of compiler flags: -Wall -Wimplicit -Wpointer-arith -Wredundant-decls -Wshadow -Wunused -Wcast-qual -Wnested-externs -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations I also often add -Werror which causes warnings to be treated as errors. I see that there is a -Wextra as well. I'll have to play with that. Documentation on all of the warning flags can be found over here: <http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html#Warning-Options> Sometimes, figuring out the correct way to get rid of a warning can be frustrating, but after you've been doing it foe a while it becomes second nature. -- Dave Hylands Shuswap, BC, Canada http://www.DaveHylands.com/
Message
Re: [AVR-Chat] Finally, really, actually, starting off with C
2009-01-07 by Dave Hylands
Attachments
- No local attachments were found for this message.