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

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 手机应用的时间可以修改吗
  • ¥15 docker 运行OPEN-webui异常
  • ¥15 麒麟系统如何删除光盘刻录痕迹
  • ¥15 recipe通过gem协议传的是什么
  • ¥15 TS2307: Cannot find module 'cc'.
  • ¥15 100小时学会sap 书上pp章节5.22,标准成本计算逻辑?
  • ¥50 达梦数据库误删日志文件重做DAMENG01.log启动仍然-712错误
  • ¥15 cellranger化学处理类型报错
  • ¥15 用texstudio插入图片出现下面情况,怎么办
  • ¥15 ubantu 用samba挂载windows的共享文件夹,无法挂载二级目录和修改文件