코딩
bluez 사용시 undefined reference to ~~ 문제 해결
그분의부르심
2021. 5. 21. 19:20
bluez 사용시
undefined reference to 'hci_get_route'
undefined reference to 'ba2str'
등의 오류가 나서 컴파일이 안됐었다.
사실 이건 내가 바보 같은 거였는데, bluez 설치를 다했다고 생각하고 링커 옵션을 안 줬다...
gcc에서는 아래링크에서 와 같이 마지막에 -lbluetooth 옵션을 주면된다. (예시임)
$gcc -o simplescan simplescan.c -lbluetooth
makefile을 사용한다면,
LDFLAGS += -lbluetooth를 LDFLAGS 정의부 이후 아무 곳에나 삽입하면 된다.
아직 gcc와 makefile이 익숙하지 않은 사람들 중 나같은 실수를 하는 분들을 위해 적는다.
아래는 개발 중 참고한 링크다.
https://people.csail.mit.edu/albert/bluez-intro/c404.html
Bluetooth programming in C with BlueZ
Chapter 4. Bluetooth programming in C with BlueZ There are reasons to prefer developing Bluetooth applications in C instead of in a high level language such as Python. The Python environment might not be available or might not fit on the target device; st
people.csail.mit.edu