Bosch BME680: compile error, header files

Hardware notes:

  • Arduino DUE
  • Waveshare BME680, running in I2C mode (NB: SPI also available from this board)
  • Arduino IDE 2.3.4
  • Host O/S Linux MINT v21.3

Clearly I don't understand the IDE and programming language as well as I might. But I cannot seem to find a cogent answer to my problem...which is:
When compiling, I frequently get errors about missing 'header files', which (to my mind...) should be detectable by the IDE because they are in the same folder as the *.ino sketch itself. For an example,

loading library from /home/MyComputerName/Arduino/libraries/BME68X_Environmental_Sensor_code: invalid library: no header files foundloading library from /home/MyComputerName/Arduino/libraries/BOSCH_OEM_BME680: invalid library: no header files foundloading library from /home/MyComputerName/Arduino/libraries/FunctionGenerator: invalid library: no header files foundloading library from /home/MyComputerName/Arduino/libraries/RL78_Renesas: invalid library: no header files foundloading library from /home/MyComputerName/Arduino/libraries/newLCD: invalid library: no header files found
FQBN: arduino:sam:arduino_due_x_dbg
Using board 'arduino_due_x_dbg' from platform in folder: /home/MyComputerName/.arduino15/packages/arduino/hardware/sam/1.6.12
Using core 'arduino' from platform in folder: /home/MyComputerName/.arduino15/packages/arduino/hardware/sam/1.6.12

Detecting libraries used...
In file included from /home/MyComputerName/Arduino/libraries/BOSCH_OEM_BME680/examples/BSEC_Integration_Examples/examples/bsec_iot_example/bsec_iot_example.ino:78:0:
/home/MyComputerName/Arduino/libraries/BOSCH_OEM_BME680/examples/BSEC_Integration_Examples/examples/bsec_iot_example/bsec_integration.h:86:20: fatal error: bme68x.h: No such file or directory
 #include "bme68x.h"
                    ^
compilation terminated.
/home/MyComputerName/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -mcpu=cortex-m3 -mthumb -DF_CPU=84000000L -DARDUINO=10607 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Arduino LLC" -DUSB_PRODUCT="Arduino Due" -I/home/MyComputerName/.arduino15/packages/arduino/hardware/sam/1.6.12/system/libsam -I/home/MyComputerName/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/CMSIS/Include/ -I/home/MyComputerName/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/Device/ATMEL/ -I/home/MyComputerName/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino -I/home/MyComputerName/.arduino15/packages/arduino/hardware/sam/1.6.12/variants/arduino_due_x /home/MyComputerName/.cache/arduino/sketches/EA8B84D8023403BF592F10AD7F327F35/sketch/bsec_iot_example.ino.cpp -o /dev/null
Alternatives for bme68x.h: []
ResolveLibrary(bme68x.h)
  -> candidates: []
exit status 1

Compilation error: bme68x.h: No such file or directory

The *.ino Sketch that caused this error is the one directly from Bosch (downloaded today). I tried versions of *.ino from Waveshare (and carefully made the changes they explicitly called for, to change the communication mode to i2c...but to no avail; I kept getting communication errors. I ran the Linux terminal command "sudo i2cdetect -y 1", which confirmed that there were no i2c devices connected anywhere!). So here is the Bosch *.ino

/**
 * Copyright (C) Bosch Sensortec GmbH. All Rights Reserved. Confidential.
 *
 * Disclaimer
 *
 * Common:
 * Bosch Sensortec products are developed for the consumer goods industry. They may only be used
 * within the parameters of the respective valid product data sheet. Bosch Sensortec products are
 * provided with the express understanding that there is no warranty of fitness for a particular purpose.
 * They are not fit for use in life-sustaining, safety or security sensitive systems or any system or device
 * that may lead to bodily harm or property damage if the system or device malfunctions. In addition,
 * Bosch Sensortec products are not fit for use in products which interact with motor vehicle systems.
 * The resale and/or use of products are at the purchaser's own risk and his own responsibility. The
 * examination of fitness for the intended use is the sole responsibility of the Purchaser.
 *
 * The purchaser shall indemnify Bosch Sensortec from all third party claims, including any claims for
 * incidental, or consequential damages, arising from any product use not covered by the parameters of
 * the respective valid product data sheet or not approved by Bosch Sensortec and reimburse Bosch
 * Sensortec for all costs in connection with such claims.
 *
 * The purchaser must monitor the market for the purchased products, particularly with regard to
 * product safety and inform Bosch Sensortec without delay of all security relevant incidents.
 *
 * Engineering Samples are marked with an asterisk (*) or (e). Samples may vary from the valid
 * technical specifications of the product series. They are therefore not intended or fit for resale to third
 * parties or for use in end products. Their sole purpose is internal client testing. The testing of an
 * engineering sample may in no way replace the testing of a product series. Bosch Sensortec
 * assumes no liability for the use of engineering samples. By accepting the engineering samples, the
 * Purchaser agrees to indemnify Bosch Sensortec from all claims arising from the use of engineering
 * samples.
 *
 * Special:
 * This software module (hereinafter called "Software") and any information on application-sheets
 * (hereinafter called "Information") is provided free of charge for the sole purpose to support your
 * application work. The Software and Information is subject to the following terms and conditions:
 *
 * The Software is specifically designed for the exclusive use for Bosch Sensortec products by
 * personnel who have special experience and training. Do not use this Software if you do not have the
 * proper experience or training.
 *
 * This Software package is provided `` as is `` and without any expressed or implied warranties,
 * including without limitation, the implied warranties of merchantability and fitness for a particular
 * purpose.
 *
 * Bosch Sensortec and their representatives and agents deny any liability for the functional impairment
 * of this Software in terms of fitness, performance and safety. Bosch Sensortec and their
 * representatives and agents shall not be liable for any direct or indirect damages or injury, except as
 * otherwise stipulated in mandatory applicable law.
 *
 * The Information provided is believed to be accurate and reliable. Bosch Sensortec assumes no
 * responsibility for the consequences of use of such Information nor for any infringement of patents or
 * other rights of third parties which may result from its use. No license is granted by implication or
 * otherwise under any patent or patent rights of Bosch. Specifications mentioned in the Information are
 * subject to change without notice.
 *
 * It is not allowed to deliver the source code of the Software to any third party without permission of
 * Bosch Sensortec.
 *
 */

/*!
 * @file bsec_iot_example.ino
 *
 * @brief
 * Example for using of BSEC library in a fixed configuration with the BME68x sensor.
 * This works by running an endless loop in the bsec_iot_loop() function.
 */

/*!
 * @addtogroup bsec_examples BSEC Examples
 * @brief BSEC usage examples
 * @{*/

/**********************************************************************************************************************/
/* header files */
/**********************************************************************************************************************/

#include "bsec_integration.h"
#include "commMux.h"
#include "bsec_selectivity.h"
#include <Wire.h>

String output;
uint32_t overflowCounter;
uint32_t lastTimeMS;
commMux communicationSetup[NUM_OF_SENS];

/**********************************************************************************************************************/
/* functions */
/**********************************************************************************************************************/

/*!
 * @brief           Write operation in either Wire or SPI
 *
 * param[in]        reg_addr        register address
 * param[in]        reg_data_ptr    pointer to the data to be written
 * param[in]        data_len        number of bytes to be written
 * param[in]        intf_ptr        interface pointer
 *
 * @return          result of the bus communication function
 */
int8_t bus_write(uint8_t reg_addr, const uint8_t *reg_data_ptr, uint32_t data_len, void *intf_ptr)
{
    uint8_t dev_addr = *(uint8_t*)intf_ptr;
    
    Wire.beginTransmission(dev_addr);
    Wire.write(reg_addr);    /* Set register address to start writing to */
 
    /* Write the data */
    for (int index = 0; index < data_len; index++) {
        Wire.write(reg_data_ptr[index]);
    }
 
    return (int8_t)Wire.endTransmission();
}

/*!
 * @brief           Read operation in either Wire or SPI
 *
 * param[in]        reg_addr        register address
 * param[out]       reg_data_ptr    pointer to the memory to be used to store the read data
 * param[in]        data_len        number of bytes to be read
 * param[in]        intf_ptr        interface pointer
 * 
 * @return          result of the bus communication function
 */
int8_t bus_read(uint8_t reg_addr, uint8_t *reg_data_ptr, uint32_t data_len, void *intf_ptr)
{
    int8_t comResult = 0;
    uint8_t dev_addr = *(uint8_t*)intf_ptr;
    Wire.beginTransmission(dev_addr);
    Wire.write(reg_addr);                    /* Set register address to start reading from */
    comResult = Wire.endTransmission();
 
    delayMicroseconds(150);                 /* Precautionary response delay */
    Wire.requestFrom(dev_addr, (uint8_t)data_len);    /* Request data */
 
    int index = 0;
    while (Wire.available())  /* The slave device may send less than requested (burst read) */
    {
        reg_data_ptr[index] = Wire.read();
        index++;
    }
 
    return comResult;
}

/*!
 * @brief           System specific implementation of sleep function
 *
 * @param[in]       t_us     Time in microseconds
 * @param[in]       intf_ptr Pointer to the interface descriptor
 * 
 * @return          none
 */
void sleep_n(uint32_t t_us, void *intf_ptr)
{
  delay(t_us / 1000);
}

/*!
 * @brief           Capture the system time in microseconds
 *
 * @return          system_current_time    current system timestamp in microseconds
 */
int64_t get_timestamp_us()
{
    int64_t timeMs = millis() * 1000;

    if (lastTimeMS > timeMs) /* An overflow occurred */
    { 
        overflowCounter++;
    }
    lastTimeMS = timeMs;
    
    return timeMs + (overflowCounter * INT64_C(0xFFFFFFFF));
}

/*!
 * @brief           Handling of the ready outputs
 *
 * @param[in]       outputs                 output_t structure
 * @param[in]       bsec_status             value returned by the bsec_do_steps() call
 *
 * @return          none
 */
void output_ready(output_t *outputs, bsec_library_return_t bsec_status)
{
  digitalWrite(LED_BUILTIN, LOW);
  float timestamp_ms = outputs->timestamp/1e6;

  output = String(outputs->sens_no) + ",";
  output += String(timestamp_ms) + ", ";

#if (OUTPUT_MODE == CLASSIFICATION || OUTPUT_MODE == REGRESSION)
  output += String(outputs->gas_estimate_1) + ", ";
  output += String(outputs->gas_estimate_2) + ", ";
  output += String(outputs->gas_estimate_3) + ", ";
  output += String(outputs->gas_estimate_4) + ", ";
  output += String(outputs->gas_accuracy_1) + ", ";
  output += String(outputs->gas_accuracy_2) + ", ";
  output += String(outputs->gas_accuracy_3) + ", ";
  output += String(outputs->gas_accuracy_4) + ", ";
  output += String(outputs->raw_pressure) + ", ";
  output += String(outputs->raw_temp) + ", ";
  output += String(outputs->raw_humidity) + ", ";
  output += String(outputs->raw_gas) + ", ";
  output += String(outputs->raw_gas_index) + ", ";
#elif (OUTPUT_MODE == IAQ)
  output += String(outputs->iaq) + ", ";
  output += String(outputs->iaq_accuracy) + ", ";
  output += String(outputs->static_iaq) + ", ";
  output += String(outputs->raw_temp) + ", ";
  output += String(outputs->raw_humidity) + ", ";
  output += String(outputs->temperature) + ", ";
  output += String(outputs->humidity) + ", ";
  output += String(outputs->raw_pressure) + ", "; 
  output += String(outputs->raw_gas) + ", ";
  output += String(outputs->gas_percentage) + ", ";
  output += String(outputs->co2_equivalent) + ", ";
  output += String(outputs->breath_voc_equivalent) + ", ";
  output += String(outputs->stabStatus) + ", ";
  output += String(outputs->runInStatus) + ", ";
  output += String(outputs->compensated_gas) + ", ";
#endif

  output += String(bsec_status);
  Serial.println(output);
  digitalWrite(LED_BUILTIN, HIGH);
}

/*!
 * @brief           Load previous library state from non-volatile memory
 *
 * @param[in,out]   state_buffer    buffer to hold the loaded state string
 * @param[in]       n_buffer        size of the allocated state buffer
 *
 * @return          number of bytes copied to state_buffer
 */
uint32_t state_load(uint8_t *state_buffer, uint32_t n_buffer)
{
    // ...
    // Load a previous library state from non-volatile memory, if available.
    //
    // Return zero if loading was unsuccessful or no state was available, 
    // otherwise return length of loaded state string.
    // ...
    return 0;
}

/*!
 * @brief           Save library state to non-volatile memory
 *
 * @param[in]       state_buffer    buffer holding the state to be stored
 * @param[in]       length          length of the state string to be stored
 *
 * @return          none
 */
void state_save(const uint8_t *state_buffer, uint32_t length)
{
    // ...
    // Save the string some form of non-volatile memory, if possible.
    // ...
}

/*!
 * @brief           Load library config from non-volatile memory
 *
 * @param[in,out]   config_buffer    buffer to hold the loaded state string
 * @param[in]       n_buffer        size of the allocated state buffer
 *
 * @return          number of bytes copied to config_buffer
 */
uint32_t config_load(uint8_t *config_buffer, uint32_t n_buffer)
{
	memcpy(config_buffer, bsec_config_selectivity, n_buffer);
    return n_buffer;
}

/*!
 * @brief       Main function which configures BSEC library and then reads and processes the data from sensor based
 *              on timer ticks
 *
 * @return      result of the processing
 */
void setup()
{
    return_values_init ret;
    pinMode(LED_BUILTIN, OUTPUT);
    /* Init I2C and serial communication */
    Wire.begin();
    commMuxBegin(Wire, SPI);
    Serial.begin(115200);
    delay(1000);

	struct bme68x_dev bme_dev[NUM_OF_SENS];
  
	for (uint8_t i = 0; i < NUM_OF_SENS; i++) {

		/* Sets the Communication interface for the given sensor */
		communicationSetup[i] = commMuxSetConfig(Wire, SPI, i/*SENS_NUM*/, communicationSetup[i]);

		memset(&bme_dev[i],0,sizeof(bme_dev[i]));
		bme_dev[i].intf = BME68X_SPI_INTF;
		bme_dev[i].read = commMuxRead;
		bme_dev[i].write = commMuxWrite;
		bme_dev[i].delay_us = commMuxDelay;
		bme_dev[i].intf_ptr = &communicationSetup[i];
		bme_dev[i].amb_temp = 25;

		/* Assigning a chunk of memory block to the bsecInstance */
		allocateMemory(bsec_mem_block[i], i);

		/* Call to the function which initializes the BSEC library
		* Switch on low-power mode and provide no temperature offset */
		ret = bsec_iot_init(SAMPLE_RATE, 0.0f, bus_write, bus_read, sleep_n, state_load, config_load, bme_dev[i], i);

		if (ret.bme68x_status)
		{
			/* Could not initialize BME68x */
			Serial.println("ERROR while initializing BME68x:"+String(ret.bme68x_status));
			return;
		}
		else if (ret.bsec_status < BSEC_OK)
		{
			printf("\nERROR while initializing BSEC library: %d\n", ret.bsec_status);
			return;
		}
		else if (ret.bsec_status > BSEC_OK)
		{
			printf("\nWARNING while initializing BSEC library: %d\n", ret.bsec_status);
		}
	}

	bsec_version_t version;
	bsec_get_version_m(bsecInstance, &version);
	Serial.println("\nBSEC library version " + String(version.major) + "." + String(version.minor) + "." \
					+ String(version.major_bugfix) + "." + String(version.minor_bugfix));

#if (OUTPUT_MODE == CLASSIFICATION || OUTPUT_MODE == REGRESSION)
    String file_header = "\nSensor_No, Time(ms), Class/Target_1_prediction, Class/Target_2_prediction, Class/Target_3_prediction, Class/Target_4_prediction, Prediction_accuracy_1, Prediction_accuracy_2, Prediction_accuracy_3, Prediction_accuracy_4, Raw_pressure(Pa), Raw_Temperature(degC),  Raw_Humidity(%rH), Raw_Gas(ohm), Raw_Gas_Index(num), Bsec_status";
#elif (OUTPUT_MODE == IAQ)
	String file_header = "\nSensor_No, Time(ms), IAQ, IAQ_accuracy, Static_IAQ, Raw_Temperature(degC), Raw_Humidity(%rH), Comp_Temperature(degC),  Comp_Humidity(%rH), Raw_pressure(Pa), Raw_Gas(ohms), Gas_percentage, CO2, bVOC, Stabilization_status, Run_in_status, Compensated_gas, Bsec_status";
#endif
  
	Serial.println(file_header);
    /* Call to endless loop function which reads and processes data based on sensor settings */
    /* State is saved every 10.000 samples, which means every 10.000 * 3 secs = 500 minutes  */
    bsec_iot_loop(sleep_n, get_timestamp_us, output_ready, state_save, 10000);
}

void loop()
{
}

/*! @}*/

If anyone can help to point me in the correct direction, it would be much appreciated!

The compiler is telling you exactly what directories it is expecting to find the libraries in, and also telling you that there are no header files in those directories. Have you looked in those directories to see what, if anything, is contained within them?

Hmmmm.
Well, the desired *.h files do exist....and they are in the main folder. But there are several sub-folders.

  1. Is there a way to Force the compiler to search in the sub-folders? Or,

  2. Do I have to specify which sub-folder the *.h files are in? And,

  3. If I must specify the sub-folder, then what is the correct syntax / structure to identify the Path to the *.h file?

I repeat:

If you want to go up against the IDE and try and force it to do things your way, have at it.

Or, if you want to get actual work done, you can put the libraries where the IDE is expecting to find them.

It's your choice.

1 Like

Are you trying to use the following libraries?

#include "bsec_integration.h"
#include "commMux.h"
#include "bsec_selectivity.h"
#include <Wire.h>

If you are, you do NOT touch the .h files, you install the library using the Library Manager.
BTW, here are the rules for includes
<> is system
"" is local followed by system. Used to override a system declare
EDIT: If the .h files you enclosed in "" are part of the software that came with the hardware, then they go in the same folder as the ino file.
Where did you get the sketch from?

OK, so perhaps I am lacking some basic understanding here. I am -- emphatically -- not interested in using sledgehammer techniques, or re-creating the wheel, or attempting to be "Smarter than the Average Bear, Boo-Boo"

So the problematic *.h file is in the Library

@van_der_decken I went to the Waveshare site and was reminded why I hate their install instructions. Love their products, but unless you are experienced in the Arduino ecosystem, their old instructions will lead you astray.
If you want my help with this, I need to see everything you did so we know how to fix it OR uninstall the entire Arduino IDE and start from scratch. What do you want to do?

For comic relief, I can say that I just repeated the old black-and-white-movie meme, wherein the telephone-switchboard operator gets frustrated with the tangle of cords, and yanks out all the plugs from the board. This has been 6 hours of groping in the dark and I cannot get this stupid sensor to even say HELLO WORLD
Anyway, here is a quick summary of my work today since receiving the little devil of a board:

  1. I tried the very simplest of things first, like using the Example from Waveshare (the mfr of the sensor board).
  2. That did not work "as is", so I resorted to their website and found that if I wanted to use the I2C mode I had to alter the software, which I did....and still no luck.
  3. Then, I tried the "OEM" Bosch versions available from the Library Manager. I had no luck with those
  4. Then, I filled out the online request from Robert Bosch GmBH and received the OEM software directly. This, I downloaded and unzipped in its own folder within the Arduino Library superfolder. I think that this mode of installation caused problems because the (.h) files were NOT inside the same folder with the .ino Sketches. Somehow, I figured that the folks at Bosch would have created the correct directory structure for their Example files (.ino) so that they would work out-of-the-box. But alas, the Bosch boffins did not do this.
  5. I copied and pasted several of the *.h files into the folder for the Example I was working with. Each time I did this, there were fewer error messages. But, it did not get rid of all of them. It seemed like more errors kept coming in the vein of "Error: first instance of {function name}...", so it seemed as if the Sketch was still working in the dark.
  6. I have since deleted ALL of the Bosch-sourced library items.
    Good news, though:
    The Adafruit "BME680 Test.ino" works flawlessly; confusingly, though, it defines the pin #s to use for MISO/MOSI/CS and SCK, but those can be safely ignored (and "commented out") if you simply use the I2C (SDA and SCL) pins.
    After 8 hours now of fussing with this little devil, I have been able to --- at the very least ! --- prove that the board is actually functioning instead of a total dud.
    Related question: Can anybody explain why the Linux-terminal command,
    sudo i2cdetect -y 1
    still does not detect the presence of this 12C device even though it is now working with the Adafruit BME680 Test sketch, in the I2C comms mode?

If you want any help, you need to listen. I was just going to mute you but I will give it one last shot. Tell me where to get a sketch that you are unable to compile. Not one of the fee based or special access, just a normal sample sketch to work with the board that you can not get a clean compile.

Hi, @polarmolar
Have you looked in the Arduino IDE and found the BME680 Library and Examples?

I compiled a couple of the examples with the DUE board selected and they compiled successfully.

Tom... :smiley: :+1: :coffee: :australia:

@polarmolar Yes, but his problem is with the Waveshare board. Waveshare makes cool hardware but their software install directions are archaic. That is what he has a problem with.

Thanks for your patience.
The board does work (as proven by using the Adafruit library, see above)
But it would be appreciated, as a learning experience, to understand why the Waveshare library does not work. If you are willing to help me I would be thankful.
So I downloaded the Waveshare software from their site
Waveshare download page
There is no link to this within the Arduino Library Manager, so I placed the ZIP file in a newly created folder in the same Library directory as all the other Arduino libraries (--> so there should be no issues with the "Path").
When the ZIP is extracted in-situ, the *.h files are not in the same folder along with the Arduino Demo sketch, forced_mode.ino
So I copied all of the Waveshare *.h files, and pasted those into the same folder with forced_mode.ino.
Here is a un-altered copy of the forced_mode.ino code:

/**
 * Copyright (C) 2021 Bosch Sensortec GmbH
 *
 * SPDX-License-Identifier: BSD-3-Clause
 * 
 */

#include "Arduino.h"
#include "bme68xLibrary.h"

#ifndef PIN_CS
#define PIN_CS SS
#endif

#ifndef ADD_I2C
#define ADD_I2C 0x77
#endif

Bme68x bme;

/**
 * @brief Initializes the sensor and hardware settings
 */
void setup(void)
{
  //Wire.begin();     //I2C mode
	SPI.begin();    //SPI mode
	Serial.begin(115200);
	
	while (!Serial)
		delay(10);
		
	/* initializes the sensor based on SPI library */
	bme.begin(PIN_CS, SPI);     //SPI mode
  //bme.begin(ADD_I2C, Wire);     //I2C mode

	if(bme.checkStatus())
	{
		if (bme.checkStatus() == BME68X_ERROR)
		{
			Serial.println("Sensor error:" + bme.statusString());
			return;
		}
		else if (bme.checkStatus() == BME68X_WARNING)
		{
			Serial.println("Sensor Warning:" + bme.statusString());
		}
	}
	
	/* Set the default configuration for temperature, pressure and humidity */
	bme.setTPH();

	/* Set the heater configuration to 300 deg C for 100ms for Forced mode */
	bme.setHeaterProf(300, 100);

	Serial.println("TimeStamp(ms), Temperature(deg C), Pressure(Pa), Humidity(%), Gas resistance(ohm), Status");
}

void loop(void)
{
	bme68xData data;

	bme.setOpMode(BME68X_FORCED_MODE);
	delay(500+bme.getMeasDur()/200);
  
	if (bme.fetchData())
	{
		bme.getData(data);
		Serial.print(String(millis()) + ", ");
		Serial.print(String(data.temperature) + ", ");
		Serial.print(String(data.pressure) + ", ");
		Serial.print(String(data.humidity) + ", ");
		Serial.print(String(data.gas_resistance) + ", ");
		Serial.println(data.status, HEX);
	}
}

I then compiled the sketch forced_mode.ino, and got this unhappy result:

loading library from /home/myusername/Arduino/libraries/BME68X_Environmental_Sensor_code: invalid library: no header files foundloading library from /home/myusername/Arduino/libraries/FunctionGenerator: invalid library: no header files foundloading library from /home/myusername/Arduino/libraries/RL78_Renesas: invalid library: no header files foundloading library from /home/myusername/Arduino/libraries/Waveshare_BME680: invalid library: no header files foundloading library from /home/myusername/Arduino/libraries/newLCD: invalid library: no header files found
FQBN: arduino:sam:arduino_due_x_dbg
Using board 'arduino_due_x_dbg' from platform in folder: /home/myusername/.arduino15/packages/arduino/hardware/sam/1.6.12
Using core 'arduino' from platform in folder: /home/myusername/.arduino15/packages/arduino/hardware/sam/1.6.12

/home/myusername/Arduino/libraries/Waveshare_BME680/BME68X_Environmental_Sensor_code/Arduino/forced_mode/forced_mode.ino:9:27: fatal error: bme68xLibrary.h: No such file or directory
 #include "bme68xLibrary.h"
                           ^
compilation terminated.
Detecting libraries used...
/home/myusername/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/arm-none-eabi-g++ -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -nostdlib -fno-threadsafe-statics --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -mcpu=cortex-m3 -mthumb -DF_CPU=84000000L -DARDUINO=10607 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM -D__SAM3X8E__ -mthumb -DUSB_VID=0x2341 -DUSB_PID=0x003e -DUSBCON -DUSB_MANUFACTURER="Arduino LLC" -DUSB_PRODUCT="Arduino Due" -I/home/myusername/.arduino15/packages/arduino/hardware/sam/1.6.12/system/libsam -I/home/myusername/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/CMSIS/Include/ -I/home/myusername/.arduino15/packages/arduino/hardware/sam/1.6.12/system/CMSIS/Device/ATMEL/ -I/home/myusername/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino -I/home/myusername/.arduino15/packages/arduino/hardware/sam/1.6.12/variants/arduino_due_x /home/myusername/.cache/arduino/sketches/850213730C6AABFDDA096D46BD38009E/sketch/forced_mode.ino.cpp -o /dev/null
Alternatives for bme68xLibrary.h: []
ResolveLibrary(bme68xLibrary.h)
  -> candidates: []
exit status 1

Compilation error: bme68xLibrary.h: No such file or directory

Re: the final Compilation error message
The fact is, bme68xLibrary.h does not exist anywhere in the unzipped contents of the Waveshare folder.
But...
bme68xLibrary.h also does exist in the Bosch BME68x Sensor Library (latest version, direct from Arduino Library Manager) . It can also be downloadable from this Github link Github source for BME68xLibrary.h
And very counter-intuitively...
bme68xLibrary.h does not exist in the Bosch BSEC Sensor Library (which seems very strange because the Arduino Library Manager's description specifically says that it is for use with the BME680).
(this is probably enough for this one message)

That is because they are NOT supposed to be, they are in your sketchbook/libraries.
I copied the sketch, installed the library with one click and it compiled fine.

I can't see your directory structure but the compiler output tells me it is a mess. If you can, uninstall the IDE and make sure the /user/sketchbook/libraries is gone, or move or zip them so they aren't seen by the compiler pre-processor. Here is a picture of my library setup, I installed the library from the library manager, I did not goto the Waveshare web site at all. WARNING, there install instructions are strange and likely very old.
If you could take a similar screen grab I might be able to walk you through fixing it.
Before you ask, I have NO folder or even file for the demo sketch you posted, I simply clicked the copy button pasted it into a new empty sketch and compiled. I have not save it so it is not in any of my sketchbook folders, ALL includes/.h files are from the library.


I am ready to help, have fixed this kind of problem before, but I need you to co-operate. Let me know how you want to proceed.

Does the Waveshare documentation say what microcontrollers it will work on?

Tom.. :smiley: :+1: :coffee: :australia:

Thanks for your reply.

  1. I think that I have now resolved the issues with the directory structure (etc); I believe that during my testing I had saved one (or several) of the *.ino under a different name (to avoid altering the original) and those save-as files were not inside a separate folder of the same name as the *.ino file. Arduino IDE normally flags that as an error but somehow this "save as" operation slipped through the cracks.
    I did not have to uninstall/reinstall the IDE.
  2. I had (yesterday, prior to your Post #14) deleted both of the Bosch and the Waveshare libraries. I reinstalled the Bosch BME68x Sensor Library (v1.2.40408).
  3. The OEM Bosch BME68x Sensor Library example sketch does not work for me because the code it is only set up for SPI mode
  4. Now, the Waveshare version of forced_mode.ino does work for me but only after I discovered some dangling errors (there are two locations where alternate SPI vs I2C pairs of code have to be selected and commented out)
  5. The Adafruit BME680 code does work for me; like the Waveshare version, it has both SPI and I2C pairs of code that must be user-selected & commented-out.
  6. Trivial problem: the baud rate for the Adafruit version is only 9600, but the Waveshare and Bosch OEM versions are both 115200 and this causes an easily corrected hiccup.

Conclusion is, I seem to have resolved my problems now. I thank everyone for their comments and suggestions. I have written a lengthy reply here, so as to be helpful to others.

AFAIK we were just trying to get your compiles to work by teaching you how to properly install a library. Since you have not co-operated I will mute this thread, good luck.

Since sonofcy has now muted me, he will not read this:

sonofcy did not understand that the BME68x Sensor Library he downloaded is the one directly from Bosch. Although the Waveshare wiki does refers directly to that same library see wiki page for Arduino......very confusingly Waveshare also shows a link to download "their" Example Demo, mentioned above, which is in the form of a Zipped folder. Waveshare's supposedly proprietary Library is not available from the Arduino Library Manager. And from the very start of this misadventure, having bought a Waveshare product, I had followed their product's Wiki's directory-tree down to the "Resource" heading, which clearly shows subheadings for "Demos" and "Software"

The Waveshare wiki Waveshare wiki, for BME680 has a link "Example Demo" to download "their" BME680 library. It arrives as a zipped folder, "BME68x_Environmental_Sensor_code.zip"

This zipped-up Waveshare library has to be self-installed.
Originally, I unzipped the Waveshare library within in a folder I created and named

/home/myusername/Arduino/libraries/Waveshare_BME680/BME68X_Environmental_Sensor_code/

When running from within this folder, I had those error issues I noted in Post #12

I have since deleted that entire folder.

Today, I re-installed the Waveshare library (including its examples) in a folder named:
/home/myusername/Arduino/libraries/Waveshare BME68x/BME68X_Environmental_Sensor_code/

NB: the folder names are not the same (BME680 vs BME68x; and also the presence of an additional underscore in the former folder name).

In both cases, the unzipped library is one-level-down in the directory tree, not directly under Arduino/libraries. I chose to do this because I now have 4 libraries for the BME68x class of sensor and their names are too confusingly similar to be at the same directory level. I have other libraries with that structure, and that structure continues to work.

What I now know is: the current folder name does work, whereas the former did not. Also, I did not need to resort to trashing my entire folder system, reinstalling the IDE, and re-installing the 130+ libraries that I currently have.

What the underlying issues were, will probably remain a mystery because I don't have the tenacity to try to recreate the error. But if I had to guess, perhaps it is that the calls made from within the headers (etc.) of the Waveshare company's library were confused due to the former folder-name (i.e, the location-names of the calls did not match).

All of that pushed to one side now, a very serious flub by Waveshare is that their Wiki is internally inconsistent: After telling the reader to use the Arduino Library Manager to download the OEM version BME68x Bosch Sensortec library (which instructions perhaps sonofcy actually followed), Waveshare's Wiki screenshots show red boxes around some lines-of-code that relate to choices between 1) running in SPI mode, or 2) running in I2C mode. THOSE LINES OF CODE DO NOT EXIST IN THE OEM BOSCH LIBRARY. Those lines of code form appear only in the direct-download Waveshare proprietary version, i.e., user-installed from the Zipped folder !!!!

Also note that simply compiling the *.ino doesn't prove much, because compilation did not test the run-time problem of communication with the board

sonofcy claimed that the Waveshare's instructions / wiki was "archaic" . But it is not so much that Waveshare is not staying up-to-date but rather that they are not being careful with their content (IMHO, they need what the film industry calls a "continuity editor" -- somebody who goes through the product with the fresh eyes of an outsider, to make sure it is internally consistent)

In any case I am being persistent with this thread because I have opened a can of worms and want to make sure that somebody who finds this thread gets the benefit of my wasted hours....

Update...
I have just submitted a Service Ticket to Waveshare, with a link to this Forum topic

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.