Forditasnal ez a hiba jon ki, hol van itt a hiba, en csak warrningokat latok?
idaig lefutott ez a program. csak ujra raktam a jessie-t a raspberry pi -n es most hibat ir ki, h a leakarom futtatni >S
gcc -Wall -DEMPL_TARGET_LINUX -DMPU9150 -DAK8975_SECONDARY -I eMPL -I glue -c eMPL/inv_mpu.c
gcc -Wall -DEMPL_TARGET_LINUX -DMPU9150 -DAK8975_SECONDARY -I eMPL -I glue -c eMPL/inv_mpu_dmp_motion_driver.c
gcc -Wall -DEMPL_TARGET_LINUX -DMPU9150 -DAK8975_SECONDARY -I eMPL -I glue -c glue/linux_glue.c
gcc -Wall -DEMPL_TARGET_LINUX -DMPU9150 -DAK8975_SECONDARY -I eMPL -I glue -c mpu9150/mpu9150.c
gcc -Wall -DEMPL_TARGET_LINUX -DMPU9150 -DAK8975_SECONDARY -c mpu9150/quaternion.c
gcc -Wall -DEMPL_TARGET_LINUX -DMPU9150 -DAK8975_SECONDARY -c mpu9150/vector3d.c
gcc -Wall -c bmp180.c -o bmp180.o -lm
bmp180.c: In function ‘bmp180_set_addr’:
bmp180.c:209:2: warning: implicit declaration of function ‘ioctl’ [-Wimplicit-function-declaration]
if((error = ioctl(bmp->file, I2C_SLAVE, bmp->address)) < 0) {
^
bmp180.c: In function ‘bmp180_read_eprom_reg’:
bmp180.c:244:2: warning: implicit declaration of function ‘i2c_smbus_read_word_data’ [-Wimplicit-function-declaration]
int32_t data = i2c_smbus_read_word_data(bmp->file, reg) & 0xFFFF;
^
bmp180.c: In function ‘bmp180_read_raw_temperature’:
bmp180.c:292:2: warning: implicit declaration of function ‘i2c_smbus_write_byte_data’ [-Wimplicit-function-declaration]
i2c_smbus_write_byte_data(bmp->file, BMP180_CTRL, BMP180_TMP_READ_CMD);
^
bmp180.c: In function ‘bmp180_read_raw_pressure’:
bmp180.c:337:2: warning: implicit declaration of function ‘i2c_smbus_read_byte_data’ [-Wimplicit-function-declaration]
msb = i2c_smbus_read_byte_data(bmp->file, BMP180_REG_PRE) & 0xFF;
^
gcc -Wall -I eMPL -I glue -I mpu9150 -DEMPL_TARGET_LINUX -DMPU9150 -DAK8975_SECONDARY -c imu.c
imu.c: In function ‘read_loop’:
imu.c:293:9: warning: unused variable ‘diff_t’ [-Wunused-variable]
double diff_t;
^
imu.c:261:20: warning: unused variable ‘mytime’ [-Wunused-variable]
time_t start, end,mytime;
^
imu.c:261:16: warning: unused variable ‘end’ [-Wunused-variable]
time_t start, end,mytime;
^
imu.c:261:9: warning: variable ‘start’ set but not used [-Wunused-but-set-variable]
time_t start, end,mytime;
^
imu.c:257:7: warning: unused variable ‘c’ [-Wunused-variable]
char c;
^
gcc -Wall inv_mpu.o inv_mpu_dmp_motion_driver.o linux_glue.o mpu9150.o quaternion.o vector3d.o bmp180.o imu.o -lm -o imu -L/usr/local/lib -lwiringPi
bmp180.o: In function `bmp180_read_eprom_reg':
bmp180.c:(.text+0xe8): undefined reference to `i2c_smbus_read_word_data'
bmp180.o: In function `bmp180_read_raw_temperature':
bmp180.c:(.text+0x29c): undefined reference to `i2c_smbus_write_byte_data'
bmp180.c:(.text+0x2b8): undefined reference to `i2c_smbus_read_word_data'
bmp180.o: In function `bmp180_read_raw_pressure':
bmp180.c:(.text+0x39c): undefined reference to `i2c_smbus_write_byte_data'
bmp180.c:(.text+0x3bc): undefined reference to `i2c_smbus_read_byte_data'
bmp180.c:(.text+0x3dc): undefined reference to `i2c_smbus_read_byte_data'
bmp180.c:(.text+0x3fc): undefined reference to `i2c_smbus_read_byte_data'
collect2: error: ld returned 1 exit status
Makefile:28: recipe for target 'imu' failed
make: *** [imu] Error 1
valaki latja az error helyet mert en csak warningokat latom





A ^ jeleket figyeld. Azokban a sorokban van a hiba.
A kompiler nem találja a deklarációját bizonyos funkcióknak:
ioctl
i2c_smbus_read_word_data
i2c_smbus_write_byte_data
i2c_smbus_read_byte_data





"ld returned 1 exit status"
A linker szirénázik, nem a compiler. Ilyenkor alapesetben az ember arra gondolt, hogy nem a forráskóddal van a gond, hanem a hivatkozott libeket nem csaptad hozzá a fordításhoz, vagy nem megfelelő a libed.
"warning: implicit declaration of function ‘i2c_smbus_write_byte_data’"
Ebből viszont arra következtetek, hogy be sem include-oltad a megfelelő headereket, anélkül pedig nem fog menni a dolog, mert az implicit deklarált függvény (ami nagyon nem az, amit te szeretnél) nem fog egyezni a libben található i2c_smbus_write_*_data függvénnyel, ergo amire hivatkozol "i2c_smbus_write_byte_data" néven, nem létezik, és így a linker nem is találhatja. Mindig vigyél magaddal törölk... izé... mindig figyelj oda az include-okra.
nem birok rájonni hol a baj...
kb egy évig haszsnáltam egy Jessie Debian disztribuciot a Raspberry pi 3-hoz.
Mivel mar sokat cseszekedett ujra raktam egy masik sd kartyara a rendszert,friss verzios Jessievel.
SZoval az elozon mukodott a program,ezen viszont nem mukodik ha ujbol le akarom forditani. (a regi OS rol becsomagolt fajlt athozom az ujra, lefutattom mukodik, ha viszont ujbol lefutattom a 'make' parancsot /elotte persze a 'make clean' - t akkor ezt a hiba uzenetet kapom , - pedig ahhoz a fajlhoz hozza sem nyultam/)





Ha az előzőn működött, most pedig nem jó, akkor nincs telepítve a megfelelő package.
"sudo apt-get install libi2c-dev" megvolt?
Nem :S basszus elment a napom /valami i2c- telepitettem pedig, de akkor mas volt /
koszi szepen :D megmentettel
Kapcsolódó kérdések:
Minden jog fenntartva © 2025, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!