Tutorial: Using Atmel Studio 6 with Arduino projects

The Atmel Studio 6 start screen.

In our previous Atmel tutorial, we talked about how to set up the powerful AVR Studio 5 IDE to incorporate Arduino libraries and projects. As flexible as AVR Studio 5 is, it had a few issues, and Atmel has been hard at work hustling the next major version out the door. Now, rebranded as Atmel Studio 6 (no longer just for AVRs!), the new version promises to be better, faster, and easier to use. Here, we’ll show you the quickest way to get up and running if you want to use Arduino code with all of the new features.

Note: This article explains how to set up the Atmel Studio 6 IDE for use with Arduino projects, step-by-step.  It also notes on general setup for working with Atmel devices, background on the pros/cons of working with AVR Studio, and a few other tips.  A table of contents is below; feel free to skip to any section that interests you.

Introduction

Atmel Studio 6 delivers a lot of the value that AVR Studio 5 promised but never quite gave.  Released in 2011 and based on Microsoft Visual Studio, Studio 5 was a large change from AVR Studio 4, which was based on the tried and true Eclipse IDE.  Studio 4 is seriously showing its age these days, so a refresh was welcome. However, version 5 came with a long list of bugs and didn’t deliver on a lot of the feature list, which left a lot of people wondering whether they should upgrade. The new version appears to have addressed a lot of those bugs, and gets higher marks from us in our initial testing.

Why should I switch?

Atmel Studio is a great choice for users that have outgrown the integrated Arduino IDE.  The Arduino IDE does so much under the hood that it can actually be quite limiting for experienced programmers.  As we discussed in our previous tutorial, the lack of compiler warnings and debugging capabilities (Serial.println() after every statement doesn’t count), make life hard when working on advanced projects.

AVR Studio is a huge step up from those limitations, but for many, making the switch cold turkey is just that: a huge step.  If you have a big project, porting the entire thing to pure C can be a daunting task.  Plus, some of those Arduino libraries are just so darn convenient. Software serial, anyone?  Ethernet capability?  Aw yeah.

So why not have the best of both worlds?  Arduino is basically a wrapper on top of C/C++ anyway, so technically, it’s possible to combine any Arduino sketch or library with your own custom code.  The trick is in setting up your project properly.  Here are the steps to create a fully functional Arduino project in AVR Studio 6.  Once accomplished, you can keep access to the huge Arduino user-contributed code library, but enjoy all the features of advanced AVR and a real IDE.

Preparing AVR Studio and the Arduino core library

  1. First, a few preparation steps.  This tutorial assumes you have AVR Studio installed already.  Unlike the last version, Studio 6 comes with full C++ support out of the box, so we don’t need to install anything extra.
  2. In order to build Arduino projects, we need to grab the Arduino core library. Normally, the Arduino IDE compiles this for us whenever we compile a sketch. To use it in Atmel Studio, we’ll compile it first, then grab the compiled version and include it in our project. Open the Arduino IDE and turn on verbose output (“File” -> “Preferences” -> check “Show verbose output during compilation”). On Windows Vista or 7, the path should look like this:  C:/Users/<MyUser>/AppData/Local/Temp/
  3. Make sure the Arduino IDE is set for whichever chip you want to use with Atmel Studio, and compile any example sketch, such as the included blink example. In your output window at the bottom of the IDE window, you should see information on where the IDE put the temporary build output. It will look something like “C:Users\{Your User}\AppData\Local\Temp\build3173545040878149377.tmp”.
  4. Before you open it, go to your Atmel Studio working directory. This is the folder that stores all of your projects – by default, it’s “..\My Documents\Atmel Studio\”. Create a new directory here to store your Arduino core files, and name it something appropriate (“arduinoCore” or similar).
  5. Copy and paste the temporary directory from the Arduino IDE into Windows Explorer to open it. You’ll see a bunch of files, including one called core.a. Copy that file and paste it into your arduinoCore directory. Rename it from “core.a” to “libcore.a” so Atmel Studio recognizes it as a standard library. Now that it’s there, you can reuse it for any Atmel Studio project as long as you’re using the same type of AVR.
  6. If you’re converting an existing sketch called <sketch name>, open the <project_name>.cpp file from the bldxxx.tmp directory in a text editor.  You can simply copy and paste this code into your AVR Studio project to speed things up in a minute.
  7. Sweet, we’re ready to switch environments.  Open AVR Studio and create a new AVR Studio C++ executable project.  Remember to name it in the wizard that pops up, because it’s a pain to rename a project later.
  8. Choose your chip type. Many Arduino boards use the ATMega328 or 328P, which you’ll find under the megaAVR, 8-bit device family. Older Arduinos use the ATMega168, while the newer Leonardo uses the ATMega32U4. Look closely at the chip on your board for the model # if you’re unsure what chip you have.
  9. Copy and paste the source code from the compiled .cpp file you opened earlier into the project’s main .cpp file.  You can also copy/paste the source from your Arduino .pde sketch.  The first option is easier because it includes necessary function prototypes that the Arduino IDE automatically generates, while in the latter case you must add them yourself.  In either case, you have to have these prototypes, or else the compiler will complain that every single function is “not declared in this scope” when you try to build your project.  This is one of those things that the Arduino IDE hides from you.  Adding your own prototypes is a no brainer once you’re used to it, and it can actually save headache because automatic generation can cause problems in more advanced projects. Remember to include prototypes for setup() and loop() – those aren’t default CPP functions, and the AVR compiler sees them as your own additions just like anything else.
  10. Add #include Arduino.h". to the very beginning of your source code.

Compiler and linker setup

C++ Compiler Directories tab screenshot

  1. Now we have to tackle proper compiler setup and linking.  Go to “Project”->”<ProjectName> Properties” (or press Alt-F7), then click on “Toolchain”.  We need to setup a bunch of compiler options here. By default, this will only edit your “Debug” build configuration, so select “All Configurations” from the Configuration drop-down menu if you want to modify both release and debug configurations at the same time.
  2. First, click on “Symbols”, in the left-hand “AVR/GNU C++ Compiler” dropdown menu. We need to add a symbol to tell the compiler the speed of our chip: for example, click the green plus icon, then enter "F_CPU=16000000L" for a 16Mhz chip. Most 5V Arduinos are running at 16Mhz, hence 16000000 (L stands for long integer). If you have a 3.3V Arduino, it will likely be set at 8Mhz, so use F_CPU=8000000L instead. Next, add another symbol to define your Arduino software version: "ARDUINO=100" for v1.0, "ARDUINO=101" for v1.01, etc.
  3. Click on to “Directories” in the same C++ Compiler menu. We need to add the directories that contain our Arduino core code and libraries, so the compiler can string it all together for us. For any Arduino project, we’ll need to tell the compiler where to find “Arduino.h” and “pins_arduino.h”. Starting in your Arduino installation directory, add the folders “./hardware/arduino/cores/arduino” and “./hardware/arduino/variants/standard”.
  4. You’ll need to add the directories of any extra Arduino libraries you’re using. For example, if you include the SoftwareSerial library, go ahead and add that directory to this section so the compiler knows where to find it. If you forget anything, the compiler will tell you when you try to build, with a message such as “SoftwareSerial.h: No such file or directory”. You should also add the home directory of your project, so the compiler can find source files there.
  5. You’ll also need to add the .cpp source files for those same linked libraries to your actual Atmel Studio project. Add a directory to your project (“Project”->”New Folder”) and name it “libraries”, to keep things organized. Then, go to “Project”->”Add Existing Item” (or Shift+Alt+A), and find the source directories for your included libraries (usually in “/libraries”, unless you have a custom setup). Select the source files, but instead of clicking the “Add” button, click the small arrow next to it, and click “Add as link”. You’ll notice the file show up in your Solution Explorer with a small shortcut icon next to it.
  6. C++ Compiler - Optimization setup screenshot

  7. Click on “Optimization” immediately under “Directories”.  Choose “Optimize for size” under “Optimization Level“.  Add "-fdata-sections" under “other optimization flags”, and check the box for “prepare functions for garbage collection”.  Next, click on “Miscellaneous” in the same list, and add "-fno-exceptions" to the “Other flags” field.  Keep in mind that the Arduino IDE keeps all other optimization flags off – feel free to leave the other default boxes in “Optimization” checked as they may improve program size, but if you’re having build problems, try turning them off.
  8. Now we’ll move on to the linker. In the left-hand menu, click on “AVR/GNU Linker”->”Libraries”. In the top Libraries section, you should already see an entry for “m”, which is the AVR math library. Add an entry called “core”, which is our libcore.a file that we grabbed earlier.
  9. We also need to tell it where to find libcore.a, so add our earlier “arduinoCore” directory under “Library search path“.
  10. Click on “AVR/GNU C++ Linker”->“Optimization”, and check the box for  “Garbage Collect unused sections (-Wl, –gc-sections)”.  This tells the linker to leave out unused portions of each library, which reduces final code size.
  11. Awesome, we’re done with the project setup. Save your settings, and we can get back to the code.

Build your project

  1. At this point, your environment should be completely set up.  Hit F7 to build your solution and watch the output window.  Is it successful?  If so, great.  If not, take a look at the errors to see if there’s a problem with the code or if it’s likely a problem with the linked files.  Also take a look at the beautiful new world of compiler warnings you’ve uncovered.  If your project is at all complex and you’ve only compiled using the Arduino IDE previously, you’ll have at least a few warnings.  These warnings won’t necessarily break your program, but they could.  Eliminating them usually means you’re following best practices.  There are a few warnings generated by the Arduino core libraries – if you’re feeling adventurous you can alter that code, but everything will work fine if you leave them alone.

Configure AVRDude to flash your compiled code

AVR Dude - External Tools setup screenshot

  1. Once you’ve built your project successfully, you need to upload it to your device.  Fortunately, you can do this using the exact same method as the Arduino IDE.  Arduino uses the avrdude utility to flash via serial, and we’ll do the same.  We just need to tell AVR Studio what options to use.  Click on “Tools”->”External Tools…”, then click “Add” in the window that pops up.
  2. If you’re using a USB to Serial cable like most Arduino boards do, note which COM port it uses and make the title something like “Usb to Serial Programmer: COM10″ for easy identification.
  3. In the “Command” field, put the path to avrdude.exe in your Arduino installation.  For example: "C:/arduino-1.0.1/hardware/tools/avr/bin/avrdude.exe" (quotes removed).
  4. In “Arguments”, paste this line: -CC:\dev\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf -v -v -patmega328p -cwiring -P\\.\COM10 -b57600 -D -Uflash:w:"$(ProjectDir)Debug\$(ItemFileName).hex":i   If you’re using Edit the path to your Arduino installation and change the COM port, chip target, and baud rate if necessary (ATMega328′s normally need 57600 baud, older ATMega168′s flash at 19200. A few of our commenters pointed out that the Arduino Ethernet uses 115200 by default, and possibly the ATMega328P as well. Check what the Arduino IDE is using and copy that for your model).  The rest of the flags are the exact same as the Arduino IDE uses.  The “-v” flags control the level of verbosity – feel free to play with this parameter.  You can include up to four “-v”s (which logs every serial byte transmitted, woohoo!), but we’ve found that two flags provide enough information without being overwhelming.  Note: if you have any trouble with this step, go back to the Arduino IDE and flash a project in verbose mode by holding Shift while you press the “Upload” button.  This will display all of the command line output in the bottom status window, and you can see exactly what command your system is using to call avrdude.exe.  Edit accordingly for the AVR Studio options.  You may also want to check the “Use Output window” box so you can see the results of the flash; otherwise AVRDude will open a command window and close it the moment it’s done. If you’re using an older version of the Arduino software (prior to 1.0.2), you may need to replace “-cwiring” with “-carduino”. Again, it’s best to check what arguments the IDE is using and copy those.

Flash!

  1. Boo yah.  Go back to your project and click on the “Tools” menu; there should now be a new menu item for your “USB to Serial Programmer”.  Make sure you have the main .cpp source file open in your IDE window – the serial programmer will try to access a .hex file for whatever tab is open, so this is the only one that will work. Ensure your Arduino is connected to your computer, then click the Programmer menu item.  You should see AVRDude open up in your output window, then a progress bar showing flash status.  Look for the “AVRDude is done.  Thank you!” message after a successful flash.

A lot of this prep work only needs to be done once.  You’ll need to set up the toolchain properly for each project you create, but now that you have the Arduino core library and some practice, things go much quicker the 2nd time.  The AVRDude setup is universal and can be reused for every project.

You’re done!  You now have an Arduino with a fully working project, and a huge amount of new development possibilities ahead of you.  Explore AVR Studio and everything it has to offer, you’ll be impressed.  The AVR Simulator and step-through debugging are absolutely priceless when you’re working on a complex project, and you can now mix Arduino and avr-libc code to your hearts content.

Final Notes:

  1. In some cases, your build may produce ‘cxa_pure_virtual()’ errors.  This is due to a missing error handling function for pure virtuals in C++, but we can provide it ourselves:  add
    extern "C" void __cxa_pure_virtual() { while (1); }

    to your main source file.  This function doesn’t do much, but from what we’ve read these errors can safely be ignored, so we just provide a dummy function to make the compiler happy.  You could also place this in a "pure_virtual.cpp" file and then include it in every new project.

  2. Are you looking for a cross platform solution?  You won’t find it here, as AVR Studio is Windows only.  If that’s alright with you, full steam ahead, but otherwise, you may want to look at Eclipse as a full-featured, cross-platform IDE.  AVR Studio has some features that Eclipse doesn’t (the AVR Simulator is huge, among other things), but the latter is no slouch.  The Eclipse setup process is similar and is outlined in great detail on the Arduino website.

Further reading

Smiley’s Workshop, a site dedicated to AVR programming and projects, has a comprehensive article on switching from the Arduino IDE to AVR Studio.  It’s a bit older and discusses AVR Studio 4 instead of 5, but is excellent background reading if you’re still trying to wrap your head around everything.

40 thoughts on “Tutorial: Using Atmel Studio 6 with Arduino projects

  1. Hi
    Thanks you very much for this good description. It is easier than with AVR Studio 5.
    I think there is a little mistake here: “Uflash:w:”$(ProjectDir)Debug$(ItemFileName).hex”:i” you missed the “\” after Debug.

  2. Thanks for this tutorial guys. I was able to configure, compile, and upload a blink test program to a breadboarded 328p. However, while trying to compile a larger sketch, one that uses an external library, FastSPI, that failed.

    In the AVR?GNU C++ Compiler Directories section, I do have the path to the library listed, it goes to the arduino-1.0.1\libraries\FastSPI_LED path. I’m not sure what else I needed to do to get this library included. Do I have to compile/upload it first from the IDE to get a “.a” library first and include that?

    Right now when I try to compile, I get this:

    Building target: Hoop.elf
    Invoking: AVR8/GNU Linker : (AVR_8_bit_GNU_Toolchain_3.4.1_798) 4.6.2
    “C:\Program Files (x86)\Atmel\Atmel Studio 6.0\extensions\Atmel\AVRGCC\3.4.1.81\AVRToolchain\bin\avr-g++.exe” -o Hoop.elf Hoop.o -Wl,-Map=”Hoop.map” -Wl,–start-group -Wl,-lm -Wl,-lcore -Wl,–end-group -Wl,-L”C:\Users\Ashley M. Kirchner\Documents\Atmel Studio\arduinoCore” -Wl,–gc-sections -mmcu=atmega328p
    Hoop.o: In function `CFastSPI_LED::setLeds(int)’:
    C:\Users\Ashley M. Kirchner\Documents\Atmel Studio\Hoop\Hoop\Debug/.././Hoop.cpp(250,1): undefined reference to `FastSPI_LED’
    C:\Users\Ashley M. Kirchner\Documents\Atmel Studio\Hoop\Hoop\Debug/.././Hoop.cpp(250,1): undefined reference to `FastSPI_LED’
    C:\Users\Ashley M. Kirchner\Documents\Atmel Studio\Hoop\Hoop\Debug/.././Hoop.cpp(250,1): undefined reference to `FastSPI_LED’

    etc., etc.

    Suggestions on how to properly include a library?

  3. Followup: that `CFastSPI_LED::setLeds(int)’ function IS part of the FastSPI library, that’s where that comes from. So it seems that it does at least read it in, but I don’t know why it fails.

    FYI, FastSPI is available from http://code.google.com/p/fastspi/ if you want to look how it’s written.

    • Have you added the FastSPI source as an “Existing Item” to your Atmel Studio project? That’s usually the cause of “undefined reference” errors like the one you describe. You should be able to see the library .cpp files somewhere in your Solution Explorer – make a new folder and add them to that if you want to avoid cluttering up your project organization.

      • All right, that got me a step further. Now it’s erroring out saying it can’t find WProgram.h. That file is being referenced at the top of the .cpp file for FastSPI:

        #if defined(ARDUINO) && ARDUINO >= 100
        #include “Arduino.h”
        #else
        #include “WProgram.h”
        #include
        #include “wiring.h”
        #endif

        I do have a #define ARDUINO 101 line in the main program’s .cpp file, not in FastSPI’s .cpp file. Should it be in both? This same if-eval is also in FastSPI’s .h file …

        I’m starting to think this is more hassle than it’s worth.

        • Seems greater than and lesser than signs are being filtered. Trying with actual HTML codes:

          #if defined(ARDUINO) && ARDUINO >= 100
          #include “Arduino.h”
          #else
          #include “WProgram.h”
          #include <pins_arduino.h>
          #include “wiring.h”
          #endif

  4. hello Sir,
    i have done all the setting you explained. its realy very nice to use the fetchers of the arduino in avr studio 6. But i have some debuts..
    1) If i am using this, can i use those pin which is not given to use in the arduino?
    2) Can i use the Pin change interrupt and all 8 external interrupt?
    3) can we do coding like before in studio 6 and just use the fetchers of arduino?

    • Hi ismail, some quick answers:

      1. Yes, you can use any pin on your AVR of choice. You’ll just have to use normal C code to manipulate those pins rather than the Arduino read/write functions.

      2. Yes.

      3. Absolutely – you can mix and match as you please, but if you use the Arduino libraries, you’ll need to structure your project according to their rules ( with setup() and loop() rather than main() ).

  5. This is a great tutorial, and it worked great up until I tried to upload it to my Arduino Uno. I think that the problem is when setting up the Tools connection. At first when I pasted the line into the arguments box and fixed the com port, an error came up saying:

    “can’t open config file “C:\dev\arduino-1.0.1\hardware/tools/avr/ect/avrdude.conf” : No such file or directory

    So I changed the path in that line to where I stored the file, in this case the line now reads:

    -CD:\MyDocs\Documents\arduino\arduino-1.0.1\hardware/tools/avr/etc/avrdude.conf -v -v -patmega328p -carduino -P\\.\COM4 -b57600 -D -Uflash:w:”$(ProjectDir)Debug\$(ItemFileName).hex”:i

    It connects to the arduino because when I select the tool, the lights on the board blink, but the program won’t load and an error comes up saying:

    avrdude.exe: stk500_getsync(): not in sync: resp=0×00

    If anyone can help with this I would greatly appreciate it.

    • Sometimes avrdude has trouble resetting the board so that it will accept new code. Try hitting the reset button as you activate the upload command. Does it make a difference?

      • Dear Moderator – Please replace my other comment with this one. Thanks.

        Using arduino version 1.05, I had the same issue with the uploading using the USB serial loader. I changed -carduino to -cwiring. This is what the 1.05 Arduino environment uses. Go to File/Preferences and in the “Show verbose output during” section, uncheck compilation and check upload. Load using the Arduino environment, scroll to the top of the output window and you can see the arguments to AVRDude.

        That was the only materially different switch. Works for me now!

        Note that I am using a Mega 2560, so the -p argument is different than what is used for the Uno. Also, since my installation path for Arduino contains spaces, double quotes enclose these arguments.

        Command: C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe

        Arguments: -C”C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf” -v -v -pATMEGA2560 -cwiring -P\\.\COM4 -b115200 -D -Uflash:w:”$(ProjectDir)Debug\$(ItemFileName).hex”:i

        Initial Directory: C:\Program Files (x86)\Arduino\hardware\tools\avr\bin

        Another quick note. If you have a serial output window open when uploading, you will get a message like this:avrdude.exe: ser_open(): can’t open device “\\.\COM4″: Access is denied.
        Simply close the serial output window.

  6. Excellent tutorial, thank you very much! I helped me to get through the whole thing (almostI) flawlessly and now I’m happy to back in my beloved VisualStudio with the Arduino ;-)

    The only problem I had:
    - Error message after first attempt to flash, saying
    “avrdude.exe: stk500_getsync(): not in sync: resp=0×00″
    - Couldn’t do the “verbose upload” in Arduino IDE (error message:)
    avrdude: usbdev_open(): did not find any USB device “usb”

    The solution was:
    - open \arduino-1.0.2\hardware\arduino\boards.txt
    - find the board I’m using (Arduino Ethernet)
    - see that ethernet.upload.speed is 115200
    - change upload speed in arguments for avrdude from -b57600 to -b115200

    Again, thank you for that great tutorial!!!

    • Hi Phil, thanks for the kind words and the tip. I didn’t realize that the Ethernet had a default baud rate of 115200 despite it using the AtMega328 chip. I’ll update the tutorial to reflect that. Thanks again!

  7. Hi, I already tried to complete these steps three times and it isn’t building.

    Could you help me?

    Error:

    make: *** [prim_proj.elf] Error 1
    Done executing task “RunCompilerTask” — FAILED.
    Done building target “CoreBuild” in project “prim_proj.cppproj” — FAILED.
    Done building project “prim_proj.cppproj” — FAILED.

    Build FAILED.
    Build: 0 succeeded or up-to-date, 1 failed, 0 skipped

  8. Found this tutorial super-useful, thanks so much! I actually tried to get this up and running in Eclipse first, but ran into problem after problem using the guidelines currently on the Arduino site. You should write their tutorial too, your writing style is a lot clearer :-P

    • Thanks Wil! Glad you found it useful. We try to post our articles to the community area of the Arduino site, but sometimes they’re a bit hidden compared to the regular documentation there. We’ll see if we can’t lobby them to feature us more often :-)

  9. What about libcore.a?? there is only 16 MHz, how to change it? get a new core.a?
    how to compile all with makefile and change the options what you want by self?

    • Hi Michal – Yes, using this method, you have to recompile libcore.a for each different processor that you plan on using. We know this isn’t ideal, however, getting Atmel Studio to compile the core libraries for each build takes much longer and can also be finicky to set up. We’re looking into a smoother way of doing it in the future.

  10. Works great! Thanks!

    One possible addition at the end of step 1 in the Compiler and Linker Setup section:

    Select “All Configurations” from the Configuration: drop down list to modify both release and debug configurations at the same time.

    From past path headaches, I also unchecked Relative Path and entered the absolute paths to the Arduino libraries.

    Your site is now in my bookmarks for AVR’s!

  11. Hello.

    Where is the main function? I mean, shouldn’t there be a main function that calls first the setup() and then the loop() inside a while(1) loop?

    Where can I find this piece of code?

    Thank you.

    • Hi kostbill, The Arduino environment differs from traditional C programming in several key ways – one of which is that it abstracts away the traditional main() function and replaces it with a one-time setup() and continual loop(). In practice, it works just as you describe, and in fact the compiler is creating just such a structure inside a normal main() behind the scenes. The language design team must have thought it would be easier for beginners to understand – not really better or worse in our opinion, but just a syntax difference to be aware of.

  12. Hello EngBlaze!

    I cannot thank you enough for publishing this tutorial!
    It couldn’t have been any easier than the steps which you have mentioned.
    Thanks a ton!

    Regards,
    Sushant

    • Hi Sushant, you’re welcome! We’re always happy to share some lessons learned. We’ve recently clarified the baud rate settings as you pointed out earlier, thanks for the feedback. Good luck with your projects!

  13. Is it possible, to use ATMEL-Studio for the Arduino DUE too?
    I would appreciate any help on this.

    When I follow this Tutorial, I can compile the Blinky-code and flash it with bossa,
    but the LED does not blink.

    • Hi EsProf,

      Most of these techniques will remain valid for the Due, but because it uses a 32 bit ARM architecture, it has some significant differences vs. the rest of Arduino’s product. You’ll need to flash a generated bin file instead of hex, using bossac.exe. The command will look something like this:

      \hardware\tools\bossac.exe --port=%1 -U false -e -w

      With that, you can create an External Tool like you did for the hex flashing command to make things easier in the future. Beyond that, the process should work, provided you have your clock speed set properly. We’ll try to do a separate post on the Due sometime soon.

  14. thanks for the tutorial I actually did everything perfectly but I was not able to perform no. 5 under Compiler and linker setup. when I tried to create a new project folder the Atmel Studio could not complete the operation and hence this error:

    C:\Users\______\Documents\Atmel Studio\hiworld\hiworld\Debug\HelloWorld.ino(39,27): LiquidCrystal.h: No such file or directory
    compilation terminated.
    make: *** [hiworld.o] Error 1
    Done executing task “RunCompilerTask” — FAILED.
    Done building target “CoreBuild” in project “hiworld.cppproj” — FAILED.
    Done building project “hiworld.cppproj” — FAILED.

    Build FAILED.
    ========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

    • Hi Samson,

      It looks like the compiler can’t find your LiquidCrystal header file, so either it’s not in the project folder or not linked properly. What does Studio tell you when you try to complete that linking step?

    • Thanks for the feedback! We have seen several models that use the higher baudrate, which is becoming more common as Arduino releases new units. We’ll update the tutorial to reflect this.

  15. Hello Guys

    Just upload my scketch, when trying to compille, I got two errors saying:
    1. Error 5 cannot find -lcore 1 1 Project1
    2. Error 6 ld returned 1 exit status collect2.exe 0 0 Project1

    I verified the link of core and It well linked.

    Anyone helps please! Thanks

  16. Hello Guys

    Need help. Since yesterday, I tried to biuld but always getting errors.

    Error 5 undefined reference to `setTime(int, int, int, int, int, int)’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 77 1 TestProject
    Error 6 undefined reference to `Servo::attach(int)’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 83 1 TestProject
    Error 7 undefined reference to `Servo::attach(int)’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 84 1 TestProject
    Error 8 undefined reference to `Servo::attach(int)’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 85 1 TestProject
    Error 9 undefined reference to `Servo::write(int)’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 385 1 TestProject
    Error 10 undefined reference to `Servo::write(int)’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 394 1 TestProject
    Error 11 undefined reference to `Servo::write(int)’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 403 1 TestProject
    Error 12 undefined reference to `minute()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 105 1 TestProject
    Error 13 undefined reference to `hour()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 114 1 TestProject
    Error 14 undefined reference to `hour()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 119 1 TestProject
    Error 15 undefined reference to `minute()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 125 1 TestProject
    Error 16 undefined reference to `minute()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 130 1 TestProject
    Error 17 undefined reference to `minute()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 133 1 TestProject
    Error 18 undefined reference to `Servo::Servo()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 55 1 TestProject
    Error 19 undefined reference to `Servo::Servo()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 56 1 TestProject
    Error 20 undefined reference to `Servo::Servo()’ c:\users\mulex\documents\atmel studio\6.2\PFE_Ced\PFE_Ced\Debug/PFE_Code1_0.ino 57 1 TestProject
    Error 21 ld returned 1 exit status collect2.exe 0 0 PFE_Ced

    Sound like it not recognizeing my two libraries (Time.h and Servo.h). I linked my two libraries as in tuto. add #include ”arduino.h” at very begenning of the code.

    Thank you!

    Any idea, please!

  17. Hello

    Now I get this

    Error 5 cannot find -lTime 1 1 TestProject
    Error 6 cannot find -lServo 1 1 TestProject
    Error 7 ld returned 1 exit status collect2.exe 0 0 TestProject

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>