Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • Re-Compile your program with these settings enabled
Save the new Output to a Text File and....
Support requests without the output above may be impossible to answer, so please help us to help you
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
Page Index Toggle Pages: 1
Send Topic Print
#if (ARDUINO >= 100) works in .h but not .cpp. (Read 2350 times)
Robert Mann

Posts: 2
Bakersfield, CA
#if (ARDUINO >= 100) works in .h but not .cpp.
Oct 18th, 2015 at 12:22pm
So let me try to explain this.  I have this statement in my class files .h In Visual Studio it grays out the the

#include <WProgram.h>

line so I can tell it will use the #include <Arduino.h> line.

Code (C++):
#if (ARDUINO >= 100)
# include <Arduino.h>
# include <WProgram.h>

But that same code in my classes .cpp file grays out the

#include <Arduino.h>

line and shows that it will use the #include <WProgram.h> instead.

I have also noticed that Intellisense does not work in my .cpp files but works fine in my .h files.

Am I missing a setting someplace?
Back to top
IP Logged
Visual Micro

Posts: 10570
United Kingdom
Re: #if (ARDUINO >= 100) works in .h but not .cpp.
Reply #1 - Oct 18th, 2015 at 2:53pm

It sounds like VS doesn't think the cpp is part of the project.

I just added a cpp/h file to a project and the code correctly shows the disabled state.

How did you create the cpp?
How did you open it?

If you don't see an obvious solution then please zip and email the sketch to info [at] visualmicro.com

Back to top
IP Logged
Page Index Toggle Pages: 1
Send Topic Print