#12 Adding pathes to libraries does not work


Hello !

I am trying to add a reference to the LUFA library in my project
and I cannot make it work.

Although I see it in the includes in the eclipses project directory, the compiler
always complains:

"Building file: ../Descriptors.c
Invoking: AVR Compiler
avr-gcc -Wall -g2 -gstabs -O0 -fpack-struct -fshort-enums -funsigned-char -funsigned-bitfields -mmcu=atmega16 -DF_CPU=1000000UL -MMD -MP -MF"Descriptors.d" -MT"Descriptors.d" -c -o"Descriptors.o" "../Descriptors.c"
In file included from ../Descriptors.c:38:
../Descriptors.h:42:36: warning: LUFA/Drivers/USB/USB.h: No such file or directory"

Astoundingly, making a clean, shows another path:

"make clean
rm -f ./Descriptors.o ./GenericHID.o ./LUFA/Drivers/USB/LowLevel/DevChapter9.o "

[Regard the dot and ther backslash in the last line!!]
I am attaching an image, how my includes looks like.
I tried every permutation:
- copying the LUFA lib into a subdir
- put it onto the same disk
- everything else ;-)

Even it is not possible to get rid of the references, I had to
delete an re-create the project.

I tried this with adding "includes" and "source location"
in different manners [not really clear, how to make them :-( ].

But nothing helps.

I need help!

I am using the latest updates to eclipse and the plugin.
I am using "Windows Server 2008 R2" (this is always x64), en, all patches.

Just mentioning:All my other [small] projects - using avr-include "standards"
are working well!

Thanks a lot!



  • mabra

    mabra - 2010-06-07

    Hi again!

    I would like to add two more attachments, but sourceforge migrates more and more to a pain :-)

    You can notify me via source forge [I think], so I can upload the images via email??


  • mabra

    mabra - 2010-06-07

    Part 3 -after recognizing the add button :-(

  • Thomas Holland

    Thomas Holland - 2010-06-10

    Hi mabra,

    getting the LUFA Libraries to work with managed build is indeed a bit tricky, as this "library" is designed for use with makefiles.

    So you could just switch Eclipse to 'makefile' mode and edit the demo makefiles to suit your needs.

    But it can be used in managed mode as well with some tweaking. I have been able to successfully build the GenericHID example that you seem to be using. Here are the steps required to recreate this:

    Create a new AVR Project and import the 'LUFA' directory from the LUFA zip file as well as the four files from the demo (Descriptors.c/.h & GenericHID.c/.h) into it.

    The LUFA source code expects the GNU99 C Standard, so change this in the project properties under C/C++ Build -> Settings -> Tool Settings -> AVR Compiler -> Language Standard.

    Then you need to fix the include paths. Two options -- the correct one would be to replace the brackets in all '#include <LUFA ...="">" lines in the .h files with quotes (i.e. #include "LUFA/...". The LUFA Author should learn that brackets are only used for system supplied header files)

    The other option is to add the new project in the 'Include Paths' of itself.

    Then we need to set the defines for the project. If you take a look at the makefile(s) supplied by LUFA, you will see something like this:

    LUFA library compile-time options


    Add all of them to the AVR-Compiler -> Symbols properties (without the -D)

    Then you need to tell Eclipse which files from LUFA you need compiled. Again take a look at the makefile on which files are actually needed:

      $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c        \
      $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c           \
      $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c               \
      $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/HostChapter9.c       \
      $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c           \
      $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c               \
      $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c       \
      $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \
      $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c            \
      $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c           \
      $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c            \
      $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c              \
      $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c        \

    All other parts of LUFA would just increase the size of the final program without doing anything.
    So in the project properties go to 'C/C++ General -> Paths and Symbols -> Source Location', click on 'Add Folder' and add the LUFA/Drivers/USB folder.

    The project will still not build, because the LUFA/Drivers/USB folder has some unneeded files that will cause errors.

    In the Project Explorer expand the LUFA/Drivers/USB/LowLevel folder, right click on 'Templates' and select 'Exclude from Build'
    The same with all .c files (except HID.c) in the LUFA/Drivers/USB/Class/Device folder.

    Now the project should build cleanly (it did for me)

    I have attached a zip file with the project I created. If you have problems with the steps above you can import it into Eclipse and take a look at it.



  • Thomas Holland

    Thomas Holland - 2010-06-10

    Working sample Project with LUFA (Packed with 7-zip)

  • mabra

    mabra - 2010-06-14

    Hello !

    I want to thanks you, very, very much!

    You explained really all for me and this brings a new step to my initial
    adaption training! Unbelievable, that you even made that avr project,
    I cannot thank you enough!

    Although I made a complete CMP86 BIOS [30 years ago ;-) ],
    I am like a beginner currently and have to find my avr-way
    [I mostly use NET/C#].

    I must study your other details so. But my simple
    sample is just running!

    Much, much thanks!


    [My added comment does not appear - so I add this comment :-( ]


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks