0

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??

SeahawksRdaBest
  • 868
  • 5
  • 17
  • 2
    Which version of C++ is `include_next` supported? What does it do? – Thomas Matthews Jul 08 '14 at 18:13
  • @ThomasMatthews, It's a GCC extension. It basically just searches for the same file past the current one. For example, if you have a file with the same name as one in the standard library and want to include the standard library one in yours. – chris Jul 08 '14 at 18:13
  • @ThomasMatthews, what Chris said. http://gcc.gnu.org/onlinedocs/cpp/Wrapper-Headers.html – SeahawksRdaBest Jul 08 '14 at 18:14
  • 1
    You are trying to compile arduino source in visual studio. Is it really supported? – Slava Jul 08 '14 at 18:17
  • @Slava Agreed! I'd suppose that VS cross compiling capabilities are pretty narrow. But I'd be proven wrong possibly :P ... – πάντα ῥεῖ Jul 08 '14 at 18:23
  • @Slava I've taken up this project from someone who recently left where I work. I am just following his documentation as best I can. – SeahawksRdaBest Jul 08 '14 at 18:25
  • 4
    @SeahawksRdaBest: Perhaps he left because he realised that he had agreed to do something that is not possible, and panicked rather than owning up to it. :) – Lightness Races in Orbit Jul 08 '14 at 18:27
  • 1
    @SeahawksRdaBest Another explanation could be that your former colleague used VS just as IDE for code editing, but not for compilation actually (lookup for some extra makefiles or such stuff in the project directories). I've also seen such behavior on my worksite :P ... – πάντα ῥεῖ Jul 08 '14 at 18:31
  • @πάνταῥεῖ good idea. Maybe his documentation wording just lacks – SeahawksRdaBest Jul 08 '14 at 18:33
  • @SeahawksRdaBest if you try/have to make arduino work from Visual Studio I am afraid `include_next` will not be your hardest problem. You may want to read this article: http://playground.arduino.cc/Code/VisualStudio – Slava Jul 08 '14 at 18:33
  • @Slava thankyou. I read this as a possible solution?? http://stackoverflow.com/questions/15294454/include-next-preprocessor-directive-causing-problems-in-msvc – SeahawksRdaBest Jul 08 '14 at 18:35
  • @Slava , on a side note I tried compiling the code on AtmelStudio6.1, and it gave me a error in cc1plus.exe =aurduino.h: No such file or directory. Any idea on how to fix this? – SeahawksRdaBest Jul 08 '14 at 18:42
  • @SeahawksRdaBest have you installed arduino plugin for AtmelStudio? https://gallery.atmel.com/Products/Details/20c64f07-4686-41fd-87f6-d841d568e8c5?p=6 – Slava Jul 08 '14 at 18:45
  • @Slava installing Micro.... – SeahawksRdaBest Jul 08 '14 at 19:06

2 Answers2

2

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.

Community
  • 1
  • 1
SeahawksRdaBest
  • 868
  • 5
  • 17
1

#include_next is a compiler extension (for example see Why would one use #include_next in a project?) and not part of the C++ language. As it's not part of the language your only real option (other than sticking with the original compiler that supports the extension) would be to restructure your code so that it doesn't use a user-defined file limits.h.

Community
  • 1
  • 1
Mark B
  • 95,107
  • 10
  • 109
  • 188