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 Cannot compile but under Arduino it work (Read 2849 times)
pinkfloyd11
Junior Member
**
Offline


Posts: 18
Joined: Apr 10th, 2014
Cannot compile but under Arduino it work
Feb 22nd, 2017 at 11:44am
Print Post  
Hi
a program that compile correctly under arduino do not compile under Visual Micro.
The error report say: 
 
cc1101.h*: 298:5: error: 'SPI' does not name a type
   SPI spi


I use the same cc1101 library in another visual micro project without problem.

What could be?

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


Posts: 12208
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cannot compile but under Arduino it work
Reply #1 - Feb 22nd, 2017 at 12:58pm
Print Post  
Hi,

If you have any compile issues we need to know the board you are using and see other settings. Libraries are closly tied to board architecture. One board might allow a library and another might not or might use a different version from different location.

Therefore it is always helpful to have a verbose compile output along with the build settings

Please switch on vmicro>compiler>verbose and also "vmicro>compiler>show build properties". then build and email the output as a .txt to info[at]visualmicro.com along with a link to this post.

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


Posts: 12208
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Cannot compile but under Arduino it work
Reply #2 - Feb 24th, 2017 at 2:46pm
Print Post  
Hi,

I have now tested this report and I think I can give you some information that will help understand and resolve.

The version of the arduino ide that you are using was in an interim state when it comes to discovering libraries. In visual micro if you switch off "vMicro>Compiler>Deep Search Libraries" you might find it works like before the upgrade.

However I suggest you read the following because with a few minor tweaks you can put yourself in a better known situation.

My test resulted in your error and gave identical results to the Arduino 1.8.1 ide which is much more mature than the 1.6.7 that you are using.

I used the test code below after creating a library called TestDupe containing TestDupe.h and spi.h which did not contain a definition for SPI. This will match your CC1101 configuration.

The result was a good compile if the SPI library was #included before the TestDupe library

Code
Select All
#include <SPI.h>
#include <TestDupe.h>
 



A failed compile due to SPI not being available if the TestDupe library was #included first

Code
Select All
#include <TestDupe.h>
#include <SPI.h>
 



These result are exactly as we would expect and give users some control over how duplicate library sources are resolved.

Please confirm if these points make sense, that 1.8.1 has the same issue and that you can now resolve.

Thanks

Test code

Code
Select All
void setup()
{
	SPI.begin();
}

void loop()
{
}

 



tip

An important quirk of arduino which doesn't cause an issue in this case but should be kept in mind is the name of library folders. They can more easily be matched to headers in the build process if the library folder name and an header.h have the same name. Your library folder is named LIBRERIA_CC1101 yet the master header is called cc1101.h. With lots of different libs installed you will find things become more stable using lib names that match header names. If you rename the LIBRERIA_CC1101 click "rescan" on the visual micro explorer window or restart the ide
« Last Edit: Feb 24th, 2017 at 2:50pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint