Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic cpp versus ino files - cannot locate include file (Read 3702 times)
Mark Pilant
Newbies
*
Offline


Posts: 6
Joined: Feb 22nd, 2015
cpp versus ino files - cannot locate include file
Mar 15th, 2015 at 3:10pm
Print Post  
I've just come across a very strange problem.  I have a fairly involved sketch, and was getting compilation errors trying to locate a header file with one of the files.  (It was using the Adafruit TFT libraries, but that may not matter.)  With the file type set to .cpp, I got the compilation error.  However, when I change the file type to .ino the header file can be located.

It would seem this is related to the library search paths, but I can not see anything which allows me to see the path used for the .ino case.  For the .cpp case, I can see the additional include directories in the properties.

Any ideas?

- Mark
« Last Edit: Mar 15th, 2015 at 3:38pm by Mark Pilant »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: cpp versus ino files - cannot locate include file
Reply #1 - Mar 15th, 2015 at 5:11pm
Print Post  
Hi Mark,

I think this is how Arduino works. Only library header files that are declared in a .ino are compiled so if you add any library headers to a cpp file they must also be #included in .ino

A normal Arduino will have a .ino with the same name as the project. This is regarded as the master .ino. It's the best place to put your master #includes but any .ino is fine.

Hope this makes sense.
  
Back to top
IP Logged
 
Mark Pilant
Newbies
*
Offline


Posts: 6
Joined: Feb 22nd, 2015
Re: cpp versus ino files - cannot locate include file
Reply #2 - Mar 15th, 2015 at 6:23pm
Print Post  
Possibly.  Although it was only the one Adafruit TFT header file causing the compiler problem.  Until I added that header file, the sketch built fine with a number of other header files.  Essentially one header file defining the "public" functions in the associated source file.  (Pretty standard practice.)

- Mark
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: cpp versus ino files - cannot locate include file
Reply #3 - Mar 15th, 2015 at 6:37pm
Print Post  
Local headers are ok just ones that point to libraries need to be in the .ino
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint