Error

Hey everyone,

I need help with this error. Each time I try to run this BMP280 sensor test code from the Arduino library, it keep showing this error messages. The code is attached to this message.

Arduino: 1.8.11 (Windows 10), Board: "Arduino Uno"

C:\Users\johan\AppData\Local\Temp\ccRJJre7.ltrans0.ltrans.o: In function `Adafruit_BMP280::read24(unsigned char)':

C:\Users\johan\OneDrive\Documents\Arduino\libraries\Adafruit_BMP280_Library/Adafruit_BMP280.cpp:256: undefined reference to `TwoWire::beginTransmission(unsigned char)'

C:\Users\johan\OneDrive\Documents\Arduino\libraries\Adafruit_BMP280_Library/Adafruit_BMP280.cpp:258: undefined reference to `TwoWire::endTransmission()'

C:\Users\johan\OneDrive\Documents\Arduino\libraries\Adafruit_BMP280_Library/Adafruit_BMP280.cpp:259: undefined reference to `TwoWire::requestFrom(unsigned char, unsigned char)'

C:\Users\johan\AppData\Local\Temp\ccRJJre7.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_bmp280test.ino.cpp.o.2334':

:(.text.startup+0x6a): undefined reference to `Wire'

:(.text.startup+0x6c): undefined reference to `Wire'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

bmp280test.ino (2.06 KB)

Hello Muhizi,
Looking at the sketch you posted I noticed there is a link in the beginning of the program for the tutorial location (Adafruit BMP280 I2C or SPI Barometric Pressure & Altitude Sensor [STEMMA QT] : ID 2651 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits).

/***************************************************************************
  This is a library for the BMP280 humidity, temperature & pressure sensor

  Designed specifically to work with the Adafruit BMP280 Breakout
  ----> http://www.adafruit.com/products/2651

  These sensors use I2C or SPI to communicate, 2 or 4 pins are required
  to interface.

  Adafruit invests time and resources providing this open source code,
  please support Adafruit andopen-source hardware by purchasing products
  from Adafruit!

  Written by Limor Fried & Kevin Townsend for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ***************************************************************************/

After heading over to that website I noticed it wants you to add 2 libraries listed in the attached image. Once the libraries are added it complies fine.

Mark