Including "Arduino.h" in a VS project leads to many problems with definitions

Hello everyone,

So I've been tasked with a project to get an Arduino board to blink at the press of a button on a keyboard in an already existing VS project. I've made my own class and functions that do so with the Visual Micro plugin for community 2017 but when including the header files in the VS project(which was coded in 2010) there are many errors(approx. 200) that result from definition of macros such as 'attribute' in arduino's string.h file.

After looking around, my understanding is that the MSVC compiler is unable to use these definitions because they are exclusive to the GCC compiler.

My question is if there is anything that I can do to resolve these problems, such as translating the GCC code to something that MSVC would comprehend? If so, are there any resources that would help me do so such as a translating table or library? If that is not the route to go, what about using a different compiler for different sections of the project? i.e. use MSVC for the already existing project but the new arduino addition is only compiled using GCC.

Any help would be greatly appreciated and I apologize in advance for any unclear explanations/terminology. Still very new to programming and C++ in general.


My question is if there is anything that I can do to resolve these problems...

Yes. Use the correct compiler. AVR-GCC is the correct compiler. The Visual Studio add-in you are using should have taken care of that. Given the fact that it did not you need to contact the add-in folks.

Or just the Arduino iDE.