当前位置:网站首页>开发那些事儿:Go加C.free释放内存,编译报错是什么原因?
开发那些事儿:Go加C.free释放内存,编译报错是什么原因?
2022-07-07 21:48:00 【TSINGSEE】
在EasyGBS平台功能的开发与测试过程中,我们在go中加上C.free释放内存,出现下图报错:“could not determine kind of name for C.free”(编译失败)。
以下代码为加上C.free函数后,导致编译失败:
在EasyGBS同个项目中,其他的go文件也有C.free这样的方式释放内存函数。在编译可执行文件时,并没有出现编译错误。
所以在这里,我立马联想到可能是某个C的头文件没有加进去。因为在go中写C程序,不会有错误提示。所以这样就导致写出了错误,但是不知道。只有到编译成可执行程序时才会报错。
那么针对上述情况,对比两个go中C的头文件,最终找到#include <stdlib.h>头文件的引用。
cgo中C.free可以与#include <stdlib.h>一起使用,参考如下:
作为一家起源于EasyDarwin开源框架的技术型企业,在开发过程中,我们也乐于和所有的技术开发爱好者们一起交流代码技术、分享开发经验,为大家提供一些小小的参考。
随着AI技术的不断发展和落地应用,我们也逐渐在平台中融入人工智能检测及分析技术,例如人脸检测、人脸识别、人流量统计、车辆检测、车牌识别、轨迹跟踪、行为识别等。
目前我们基于EasyCVR平台和AI安全生产摄像机,推出了可应用在企业安全生产场景中的视频+AI解决方案。其中,AI安全生产摄像机采用了全新嵌入式多算法框架,内置多种AI算法,可根据摄像头配置选择算法,除了安全帽检测,还包括烟火检测、室内通道堵塞检测、离岗睡岗检测、周界入侵检测、室外消防通道占压检测等。感兴趣的用户可以前往演示平台进行体验或部署测试。
边栏推荐
- IP network active evaluation system -- x-vision
- Line test - graphic reasoning - 2 - black and white lattice class
- LeetCode206. Reverse linked list [double pointer and recursion]
- Basic knowledge of binary tree
- Microservice Remote debug, nocalhost + rainbond microservice Development second Bomb
- Redis official ORM framework is more elegant than redistemplate
- Debezium series: MySQL tombstone event
- UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xf9 in position 56: illegal multibyte sequence
- 行测-图形推理-9-线条问题类
- Years of summary, some core suggestions for learning programming
猜你喜欢
What is fake sharing after filling the previous hole?
Ligne - raisonnement graphique - 4 - classe de lettres
UWA Q & a collection
The PHP source code of the new website + remove authorization / support burning goose instead of pumping
Redis集群安装
Microbial health network, how to restore microbial communities
Apple further entered the financial sector through the 'virtual card' security function in IOS 16
Micro service remote debug, nocalhost + rainbow micro service development second bullet
Transparent i/o model from beginning to end
C # realizes the communication between Modbus protocol and PLC
随机推荐
微服务远程Debug,Nocalhost + Rainbond微服务开发第二弹
线上面试,该如何更好的表现自己?这样做,提高50%通过率~
行测-图形推理-3-对称图形类
Revit secondary development - collision detection
Two minutes, talk about some wrong understandings of MySQL index
微生物健康网,如何恢复微生物群落
GBU1510-ASEMI电源专用15A整流桥GBU1510
Install mxnet GPU version
This experimental syntax requires enabling the parser plugin: ‘optionalChaining‘
UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xf9 in position 56: illegal multibyte sequence
Revit secondary development - cut view
Debezium series: MySQL tombstone event
How to choose the appropriate automated testing tools?
What does it mean to prefix a string with F?
LeetCode203. Remove linked list elements
Redis官方ORM框架比RedisTemplate更优雅
LeetCode707. Design linked list
Antd date component appears in English
7-51 combination of two ordered linked list sequences
Ren Qian code compilation error modification