简体   繁体   English

编译libgphoto2 / examples时未定义的参考

[英]undefined reference while compile libgphoto2/examples

My question is about libgphoto2 in gphoto2 from https://github.com/gphoto/libgphoto2/tree/master/examples 我的问题是关于https://github.com/gphoto/libgphoto2/tree/master/examples的 gphoto2中的libgphoto2

I try to compile "libgphoto2/examples/lunkwill-canon-capture.c" (basically all .c file in libgphoto2/example show same error) 我尝试编译“ libgphoto2 / examples / lunkwill-canon-capture.c”(基本上,libgphoto2 / example中的所有.c文件都显示相同的错误)

gcc -Wall -o TESTOUTPUT -lgphoto2 sample-trigger-capture.c (as libgphoto2 manual suggest) gcc -Wall -o TESTOUTPUT -lgphoto2 sample-trigger-capture.c(如libgphoto2手册所建议)

I got error 我有错误

/tmp/ccg65O2b.o: In function `wait_event_and_download':
sample-trigger-capture.c:(.text+0xad): undefined reference to `gp_camera_wait_for_event'
sample-trigger-capture.c:(.text+0x371): undefined reference to `gp_camera_file_read'
sample-trigger-capture.c:(.text+0x57b): undefined reference to `gp_camera_file_delete'
/tmp/ccg65O2b.o: In function `main':
sample-trigger-capture.c:(.text+0x607): undefined reference to `sample_create_context'
sample-trigger-capture.c:(.text+0x64c): undefined reference to `gp_log_add_func'
sample-trigger-capture.c:(.text+0x658): undefined reference to `gp_camera_new'
sample-trigger-capture.c:(.text+0x66b): undefined reference to `gp_camera_init'
sample-trigger-capture.c:(.text+0x6db): undefined reference to `gp_camera_trigger_capture'
sample-trigger-capture.c:(.text+0x799): undefined reference to `gp_camera_exit'
collect2: error: ld returned 1 exit status

What did I do wrong? 我做错了什么? best regards 最好的祝福

trying this command 尝试此命令

gcc -Wall -o TESTOUTPUT sample-trigger-capture.c -lgphoto2 -lgphoto2_port gcc -Wall -o TESTOUTPUT sample-trigger-capture.c -lgphoto2 -lgphoto2_port

you missed to include 'gphoto2_port' 您错过了包含“ gphoto2_port”的信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM