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 Compiler directives being ignored (Read 770 times)
Acuario
Full Member
***
Offline


Posts: 233
Location: Spain
Joined: Aug 28th, 2015
Compiler directives being ignored
Mar 31st, 2022 at 5:26am
Print Post  
I have a project that has evolved over time that I now build for ESP8266 and ESP32.
I use #ifdef compiler directive to include the libraries where there are differences between the two processors.

In a fresh project this works as expected.

In my evolved project it doesn't, which causes compilation to fail.
Removing the unwanted library from the libraries folder enables the project to be built successfully.
It's a bit annoying to have to do this every time I change processor.

I've tried updating the library.properties architectures value but that doesn't work.
The 'incorrect' library is definitely not included anywhere in the project but for some reason is being included.

The libraries concerned are:
for ESP8266, ESPAsyncTCP, for ESP32 AsyncTCP

I have also noticed that when I build the ESP32 code, which I'm planning to add bluetooth to, the Bluetooth and BLE libraries are being included and compiled, even though the code is excluded.

Code (C++)
Select All
#ifdef ESP32
#warning Building ESP32
#include <ESPmDNS.h>
#include <ArduinoOTA.h>
#include <Update.h>
#include <AsyncTCP.h>
#include <FS.h>
#include <ESP32SSDP.h>

static const uint8_t I2C_SDA = 18;
static const uint8_t I2C_SCL = 19;

//#define USE_BLUETOOTH
//#define USE_BLE
#ifdef USE_BLE
#include "BLEDevice.h"
#include <BLEUtils.h>
#include <BLEServer.h>
#include <BLE2902.h>
#endif
#ifdef USE_BLUETOOTH
#include "BluetoothSerial.h"
extern BluetoothSerial SerialBT;

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
#endif
#else
#warning Building ESP8266
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <Hash.h>
#endif
 



Code
Select All
Library Include Paths (26)
Include Path aries\BluetoothSerial\src'
Include Path aries\BLE\src'
.
.

 


  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: Compiler directives being ignored
Reply #1 - Mar 31st, 2022 at 10:07am
Print Post  
Thanks for the report.

When the libraries were added to the solution, were they added as cloned or shared library projects? (they will be visible in solution explorer, and have a reference to each in your main project)

If you backup your entire project to a ZIP, and then remove the VCXPROJ files, and the SLN file, then load Visual Studio, and open it from File > Open Arduino Project, and locate the INO, does this improve the issue?
  
Back to top
 
IP Logged
 
Acuario
Full Member
***
Offline


Posts: 233
Location: Spain
Joined: Aug 28th, 2015
Re: Compiler directives being ignored
Reply #2 - Mar 31st, 2022 at 4:44pm
Print Post  
The libraries were added as shared at some point..

I backed up, deleted the files as suggested and now it builds correctly for both so it looks like there was something hanging around that shouldn't have been there.


Thanks for your help.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint