OpenCV 踩坑之 error: main.o: undefined reference to symbol ‘glTexImage2D‘


当cmake编译后,make编译时发生该错误

/usr/bin/ld: /tmp/ccWzhHjf.o: undefined reference to symbol 'glTexImage2D'
/usr/lib/x86_64-linux-gnu/mesa/libGL.so: error adding symbols: DSO missing from
command line collect2: error: ld returned 1 exit status make:*** [cube] Error 1

在网上苦苦追寻并没有发现合适的解决方案,不过解决问题还得从根源出发,比如 undefined reference to symbol [ ] 的产生原因也许是因为我们在 .cpp文件下编写程序,但是又调用了.c的库函数(<GL/gl.h>),所以导致cmake工程后链接库失败,于是我们得使用以下命令解决:


extern "C"{
   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值