winavr problem?

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Helllo all,
I have a peculiar problem with winavr/gcc. I created one project and am adding 'C' code and compiling it with no problems what so ever. Recently I created a new project (using PN) and when I compiled the code, I got an error such as timers and other control registers not known (first use) also the sei () and cli () functions not found. However when I included the io.h file the errors vanished. How is it that in one projec I do not get any errors though I have not included the io.h file and in another the compiler reports errors?

Thank you.

Parthasaradhi Nayani

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you check all of your header files in your first project? Perhaps one of them includes .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the reply. Yes I checked the include files. The io.h was not included in the other project.

For the statement #include , from which directory does the compiler take this file?

regards

Parthasaradhi Nayani

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nayani P wrote:
For the statement #include , from which directory does the compiler take this file?

When the angle brackets are used, there are 2 directories that avr-gcc looks in first:

1. \avr\include
This is where most of the header files comes from. For the AVR specific headers, i.e. when you include , then the compiler searches the 'avr' subdirectory in this directory. Such as: \avr\include\avr

2. \lib\gcc-lib\avr\\include
This subdirectory contains some standard headers that come with GCC and not from avr-libc. Note that is the version of the GCC compiler that you are using such as: 3.3.2.
In this include directory are some useful files such as:
float.h
iso646.h
limits.h
stdarg.h
stdbool.h
stddef.h
unwind.h
varargs.h

Personally, I tend to use stdbool.h fairly often as it provides standard definitions for a boolean type, bool, where you can assign the variable true or false.

stddef.h is useful for sizes, maximum and minimum values for types. varargs.h is useful for functions that require variable number of arguments, but I have yet to have a need for it. You can look through the others yourself.

Last Edited: Tue. Jun 15, 2004 - 06:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much for your reply. Today when started the system and tried to compile by commenting the "include file, the program compiled without a problem. I did this to check where the error was and I did not get any. I do not know how the error vanished over night :o

Any way the problem is gone for now but hwever I would like to know the reason. Thank you.

Parthasaradhi Nayani

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know the reason either, offhand.

But FYI, you should do this:

#include

instead of this:

#include