Search code examples
c++visual-studio-2012arduinogcc-extensions

How to use Arduino with Microsoft Visual Studio ( Due to #include_next precompiler issues)


In short,

I need to do this,

#include_next <limits.h>

however Visual Studio doesn't like this and complains,

Error   40  error C1021: invalid preprocessor command 'include_next'    c:\program files (x86)\arduino\hardware\tools\g++_arm_none_eabi\arm-none-eabi\include\limits.h  141 1   DataloggerFirmware (Visual Studio 2010)

I can't simply do

#include <limits.h>

there are too many files!!.

Error   9   error C1014: too many include files : depth = 1024  c:\program files (x86)\arduino\hardware\tools\g++_arm_none_eabi\arm-none-eabi\include\limits.h  141 1   DataloggerFirmware (Visual Studio 2010)

Is there any work around??


Solution

  • I figured it out. Posting here so maybe it helps someone else.

    As I was most concerned with creating a Binary file for my Arduino board here are the steps.

    Step 1

    Make sure you have installed a version of the Arduino software from this link.

    Step 2

    Install the Visual Micro Utility. Follow this documentation carefully.

    Step 3

    Fire up Visual Studio, after installation is complete. Follow the steps it suggests. Choosing the appropriate folder for where you installed the Arduino Package.

    Restart Visual Studio. You should now see a Arduino row of options added to your Visual Studio tab (under the File save etc options).

    Select the board type and other options, and build. Voilà you're done. enter image description here

    Special shoot out to the people in the comments section.