Using Eclipse with Arduino - can't find 'Project Options/Libraries section'

Hi,

I'm trying to get Arduino to work in Eclipse, and I want to do it as close to optimal as possible, so I'm trying to follow the manual at http://www.arduino.cc/playground/Code/Eclipse. It says that

The last trap is in the fact that by default printf is not supporting float numbers. However because the C++ projects can be complex, it is wise to go to Project Options/Libraries section, you might want to include
libprintf_flt
libscanf_flt
libc
libm
libobjc
but NOT libprintf_min, libscanf_min.

I really don't have a clue as to how to find the 'Project Options/Libraries section'. Can anyone help?

I'm on Mac OS 10.7.2, using Eclipse IDE for C/C++ Developers Version: Helios Service Release 2 Build id: 20110218-0911

Thanks in advance.

Regards,

Wilbert

I'm using "Version: Helios Service Release 2, Build id: 20110301-1815" on XP.

On my setup, to add libraries I would follow these steps:

  • Right click on project name in left pane and select Open Project
  • Right click on project name (now open) and select Properties
  • Expand C/C++ Build by clicking the +
  • Left click on Settings
  • Select AVR C++ Linker / Libraries

FWIW, I've built a dozen or more applications in Eclipse and have never added the libraries you referenced :roll_eyes:

Jim

Thanks for the reply. I know that that's where you normally add libraries. In the step-by-step tutorial that I was following that place was mentioned as well. But this time the tutorial referenced a different option.

I did get everything to work. I ended up trying out different things that I found in different tutorial. But still my eclipse code compiles to bigger files then when I compile the same code in the arduino IDE. I do have the size optimization turned on. I've given up looking for it for now, but if anyone happens to know how to make sure that the eclipse projects compile as they do in the arduino IDE, I'd appreciate it.

In AVR C++ Compiler / Optimization / Other Optimization Flags, add:

-ffunction-sections -fdata-sections

(I have done likewise in AVR Compiler / Optimization / Other Optimization Flags).

In AVR Linker / General / Other Arguments, add:

-Wl,--gc-sections

If this doesn't work, you can set up your Arduino IDE to be verbose while compiling and observe the compiler and linker commands issued by the IDE. You should be able to set up Eclipse to issue identical commands.

Jim

EDIT - I found this source code for the IDE on the arduino github site (a few months back):

https://github.com/arduino/Arduino/blob/master/app/src/processing/app/debug/Compiler.java

    List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
      avrBasePath + "avr-gcc",
      "-Os",
      "-Wl,--gc-sections",
      "-mmcu=" + boardPreferences.get("build.mcu"),
      "-o",
      buildPath + File.separator + primaryClassName + ".elf"
    }));

  static private List getCommandCompilerS(String avrBasePath, List includePaths,
    String sourceName, String objectName, Map<String, String> boardPreferences) {
    List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] {
      avrBasePath + "avr-gcc",
      "-c", // compile, don't link
      "-g", // include debugging info (so errors include line numbers)
      "-assembler-with-cpp",
      "-mmcu=" + boardPreferences.get("build.mcu"),
      "-DF_CPU=" + boardPreferences.get("build.f_cpu"),
      "-DARDUINO=" + Base.REVISION,
    }));

  static private List getCommandCompilerC(String avrBasePath, List includePaths,
    String sourceName, String objectName, Map<String, String> boardPreferences) {
    List baseCommandCompiler = new ArrayList(Arrays.asList(new String[] {
      avrBasePath + "avr-gcc",
      "-c", // compile, don't link
      "-g", // include debugging info (so errors include line numbers)
      "-Os", // optimize for size
      "-w", // surpress all warnings
      "-ffunction-sections", // place each function in its own section
      "-fdata-sections",
      "-mmcu=" + boardPreferences.get("build.mcu"),
      "-DF_CPU=" + boardPreferences.get("build.f_cpu"),
      "-DARDUINO=" + Base.REVISION,
    }));

  static private List getCommandCompilerCPP(String avrBasePath,
    List includePaths, String sourceName, String objectName,
    Map<String, String> boardPreferences) {  
    List baseCommandCompilerCPP = new ArrayList(Arrays.asList(new String[] {
      avrBasePath + "avr-g++",
      "-c", // compile, don't link
      "-g", // include debugging info (so errors include line numbers)
      "-Os", // optimize for size
      "-w", // surpress all warnings
      "-fno-exceptions",
      "-ffunction-sections", // place each function in its own section
      "-fdata-sections",
      "-mmcu=" + boardPreferences.get("build.mcu"),
      "-DF_CPU=" + boardPreferences.get("build.f_cpu"),
      "-DARDUINO=" + Base.REVISION,
    }));