링크 오류 :`avahi_alternative_service_name '에 대한 정의되지 않은 참조

StackOverflow https://stackoverflow.com//questions/12712203

  •  13-12-2019
  •  | 
  •  

문제

라이브러리 에서이 기호를 찾아야합니다. Avahi 기반 테스트 코드를 컴파일하여 서비스를 봅니다.그러나 나는 undefined reference toavahi_alternative_service_name''alternative_service_name '을 얻고 있습니다 .. 나는 어떤 도서관에 있는지 모르겠지만, 나는 Ubuntu 12.04를 실행하고 있습니다.여러 패키지를 설치하려고했지만 성공하지 못했습니다 .. 어떤 생각 고마워 ..

다음은 다음과 같은 패키지가 설치되어 있습니다

dpkg --get-selections | grep avahi
avahi-autoipd                   install
avahi-daemon                    install
avahi-utils                     install
libavahi-cil-dev                install
libavahi-client-dev             install
libavahi-client3                install
libavahi-client3:i386           install
libavahi-common-data            install
libavahi-common-data:i386       install
libavahi-common-dev             install
libavahi-common3                install
libavahi-common3:i386           install
libavahi-core7                  install
libavahi-glib-dev               install
libavahi-glib1                  install
libavahi-gobject0               install
libavahi-ui-dev                 install
libavahi-ui-gtk3-0              install
libavahi-ui0                    install
libavahi1.0-cil                 install
.

명령
gcc -fpermissive testAvahi.c -o testAvahi

도움이 되었습니까?

해결책

실제로 라이브러리를 찾아서 링커로 전달하는 데 필요하므로 Follwing 명령이 나에게 작업을 수행했습니다

gcc -fpermissive testAvahi.c -o testAvahi -L/usr/lib/x86_64-linux-gnu/ -lavahi-client -lavahi-common

다른 팁

C ++ 라이브러리를 배치하는 공통 폴더가있는 경우 NM 명령을 사용하여 함수 검색을 확인할 수 있습니다.

와 같은 것
cd /usr/lib
.

nm -AC * | grep avahi_alternative_service_name

NM 유틸리티는 Binutils (sudo apt-get install binutils)에서 사용할 수 있습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top