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 #ifdef and library not included (Read 1283 times)
amelia
Junior Member
**
Offline


Posts: 10
Location: ITALY
Joined: Apr 23rd, 2013
#ifdef and library not included
Feb 9th, 2019 at 10:24am
Print Post  
1-Windows 10
2-Visual Micro 1812.22.0
3-Arduino IDE 1.8.9 2019/02/04

This is my investigation on the app WiFiSpiESP https://github.com/JiriBilek/WiFiSpiESP;
the following message was sent to the author.
***
The Visual Micro requires to have the WiFiManager installed and included;
it verifies the
configModeCallback (line 80)
anyway, not taking into account the presence of the negative directive
#ifdef WIFIMANAGER_ENABLED
...
#endif

With the
WifiManager.h
always included, OK.
It's an issue that concerns the Visual Micro Team.
***

This is the extract of code:
***
//#define WIFIMANAGER_ENABLED
...
#ifdef WIFIMANAGER_ENABLED
Ticker ticker;  // for status LED

void tick()
{
    //toggle state
    int state = digitalRead(LED_BUILTIN);  // get the current state of LED
    digitalWrite(LED_BUILTIN, !state);     // set pin to the opposite state
}

// Gets called when WiFiManager enters configuration mode
void configModeCallback(WiFiManager *myWiFiManager)
{
    //Serial.println("Entered config mode");
    //Serial.println(WiFi.softAPIP());
    //if you used auto generated SSID, print it
    //Serial.println(myWiFiManager->getConfigPortalSSID());
    // entered config mode, make led toggle faster
    ticker.attach(1, tick);
}
#endif
***

amelia

PS: With Arduino IDE directly, all OK.
« Last Edit: Feb 9th, 2019 at 10:26am by amelia »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: #ifdef and library not included
Reply #1 - Feb 9th, 2019 at 11:52am
Print Post  
Thanks for the report. The issue relates to the auto generation of prototypes. Visual Micro will shortly move to the new arduino way of generating prototypes. 

In older arduino ide versions is was not possible to put .ino methods inside conditional #if statements because the method prototypes would still be included in the final build. Instead .cpp and .h files were used and the #included in the .ino code.

Problem

In this case a prototype for the configModeCallback(WiFiManager *myWiFiManager); method is added to the final build but the method it relates to is excluded by the #ifdef

Code
Select All
void configModeCallback(WiFiManager *myWiFiManager); 



Solution

A short term workaround is to switch off the generation of prototypes in the Project Properties tool window (right click project or F4 on project in solution tree)

The attached image shows the setting.

Thanks for the report.


« Last Edit: Feb 9th, 2019 at 12:05pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint