渴望躺平 2022-07-15 16:32 采纳率: 100%
浏览 285
已结题

ormat ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘void*’

在利用caffe训练torcs自动驾驶出了问题

int main(int argc, char** argv) {
::google::InitGoogleLogging(argv[0]);

////////////////////// set up memory sharing
void *shm = NULL;
struct shared_use_st *shared;  
int shmid;

shmid = shmget((key_t)4567, sizeof(struct shared_use_st), 0666|IPC_CREAT);  
if(shmid == -1)  
{  
    fprintf(stderr, "shmget failed\n");  
    exit(EXIT_FAILURE);  
}  

shm = shmat(shmid, 0, 0);  
if(shm == (void*)-1)  
{  
    fprintf(stderr, "shmat failed\n");  
    exit(EXIT_FAILURE);  
}  
printf("\n********** Memory sharing started, attached at %X **********\n", shm); 

报错:
bin/sh: 1: cannot create .build_release/tools/torcs_run_2lane.o.warnings.txt: Permission denied
tools/torcs_run_2lane.cpp: In function ‘int main(int, char**)’:
tools/torcs_run_2lane.cpp:106:63: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘void’ [-Wformat=]
106 | printf("\n
********* Memory sharing started, attached at %X ********\n", shm);
| ~^ ~~~
| | |
| unsigned int void

| %p
tools/torcs_run_2lane.cpp:144:22: error: ‘cvLoadImage’ was not declared in this scope; did you mean ‘cvCloneImage’?
144 | IplImage
legend=cvLoadImage("../torcs/Legend6.png");
| ^~~~~~~~~~~
| cvCloneImage
tools/torcs_run_2lane.cpp:255:11: warning: unused variable ‘dist_LL_record’ [-Wunused-variable]
255 | float dist_LL_record=30;
| ^~~~~~~~~~~~~~
tools/torcs_run_2lane.cpp:256:11: warning: unused variable ‘dist_RR_record’ [-Wunused-variable]
256 | float dist_RR_record=30;
| ^~~~~~~~~~~~~~
make: *** [Makefile:539: .build_release/tools/torcs_run_2lane.o] Error 1
make: *** Waiting for unfinished jobs....

src/caffe/net.cpp:22:21: warning: ‘db_tmp’ initialized and declared ‘extern’
22 | extern leveldb::DB* db_tmp=NULL;
| ^~~~~~

我的解答思路和尝试过的方法 : 添加linux的头文件 #include <netbd.h>但是没用

求求大神帮帮我 磕头了!!!!

  • 写回答

1条回答 默认 最新

  • 脚踏南山 2022-07-15 17:39
    关注

    如有帮助,敬请采纳,你的采纳是我前进的动力,O(∩_∩)O谢谢!!!!!!!!
    你的opencv版本不对,没有这个方法,文件:tools/torcs_run_2lane.cpp:144:22: error: ‘cvLoadImage’
    你需要安装编译 3.4.x 版本的 OpenCV
    https://docs.opencv.org/3.4.3/da/d0a/group__imgcodecs__c.html

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 7月29日
  • 已采纳回答 7月21日
  • 创建了问题 7月15日

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用