简体   繁体   English

我正在尝试在 windows 上使用 make 但它给出错误

[英]I´m trying use make on windows but its giving error

I´m trying to make this project https://github.com/Slamtec/rplidar_sdk .我正在尝试制作这个项目https://github.com/Slamtec/rplidar_sdk But when i run the make command i get the following error:但是当我运行 make 命令时,我收到以下错误:

In file included from src/sl_lidar_driver.cpp:40:
src/hal/event.h: In member function 'long unsigned int rp::hal::Event::wait(long unsigned int)':
src/hal/event.h:108:20: warning: conversion from 'rp::hal::Event::<unnamed enum>' to 'long unsigned int' changes value from 'rp::hal::Event::EVENT_TIMEOUT' to '4294967295' [-Woverflow]
  108 |             return EVENT_TIMEOUT;
      |                    ^~~~~~~~~~~~~
src/sl_lidar_driver.cpp: In member function 'virtual sl_result sl::SlamtecLidarDriver::grabScanDataHq(sl_lidar_response_measurement_node_hq_t*, size_t&, sl_u32)':
src/sl_lidar_driver.cpp:556:34: error: narrowing conversion of 'rp::hal::Event::EVENT_TIMEOUT' from 'long long unsigned int' to 'long unsigned int' [-Wnarrowing]
  556 |             case rp::hal::Event::EVENT_TIMEOUT:
      |                                  ^~~~~~~~~~~~~
src/sl_lidar_driver.cpp:556:13: warning: conversion from 'long long unsigned int' to 'long unsigned int' changes value from '18446744073709551615' to '4294967295' [-Woverflow]
  556 |             case rp::hal::Event::EVENT_TIMEOUT:
      |             ^~~~
src/sl_lidar_driver.cpp: In member function 'sl_result sl::SlamtecLidarDriver::_sendCommand(sl_u16, const void*, size_t)':
src/sl_lidar_driver.cpp:1089:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<unsigned char>::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
 1089 |             for (int pos = 0; pos < cmd_packet.size(); pos++) {
      |                               ~~~~^~~~~~~~~~~~~~~~~~~
src/sl_lidar_driver.cpp:1058:19: warning: unused variable 'pkt_header' [-Wunused-variable]
 1058 |             sl_u8 pkt_header[10];
      |                   ^~~~~~~~~~
src/sl_lidar_driver.cpp: In member function 'void sl::SlamtecLidarDriver::_ultraCapsuleToNormal(const sl_lidar_response_ultra_capsule_measurement_nodes_t&, sl_lidar_response_measurement_node_hq_t*, size_t&)':
src/sl_lidar_driver.cpp:1370:40: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 1370 |                     if ((dist_predict1 == 0xFFFFFE00) || (dist_predict1 == 0x1FF)) {
      |                          ~~~~~~~~~~~~~~^~~~~~~~~~~~~
src/sl_lidar_driver.cpp:1379:40: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
 1379 |                     if ((dist_predict2 == 0xFFFFFE00) || (dist_predict2 == 0x1FF)) {
      |                          ~~~~~~~~~~~~~~^~~~~~~~~~~~~
src/sl_lidar_driver.cpp: At global scope:
src/sl_lidar_driver.cpp:72:17: warning: 'void sl::convert(const sl_lidar_response_measurement_node_hq_t&, sl_lidar_response_measurement_node_t&)' defined but not used [-Wunused-function]
   72 |     static void convert(const sl_lidar_response_measurement_node_hq_t& from, sl_lidar_response_measurement_node_t& to)
      |                 ^~~~~~~
src/sl_lidar_driver.cpp:59:17: warning: 'void sl::printDeprecationWarn(const char*, const char*)' defined but not used [-Wunused-function]
   59 |     static void printDeprecationWarn(const char* fn, const char* replacement)
    make[1]: *** [/c/rplidar_sdk/mak_common.inc:82: /c/rplidar_sdk/obj/MSYS_NT-10.0-19044/Release/sdk/src/sl_lidar_driver.o] Error 1
    make[1]: Leaving directory '/c/rplidar_sdk/sdk'
    make: *** [/c/rplidar_sdk/mak_common.inc:43: make_subs] Error 1

someone could tell me why i getting this error and how to solved it?有人可以告诉我为什么我会收到这个错误以及如何解决它?

Apparently this code is not portable.显然这段代码是不可移植的。

It appears to assume that a long int is 64bits (8 bytes) long, which is true on Linux and MacOS.似乎假设long int的长度为 64 位(8 字节),这在 Linux 和 MacOS 上是正确的。 But on Windows, a long int is only 32bits (4 bytes) long.但是在 Windows 上, long int只有 32 位(4 字节)长。

C and C++ have 5 integral types (ignoring the unsigned versions): char , short , int , long , long long . C 和 C++ 有 5 种整数类型(忽略无符号版本): charshortintlonglong long The C standard gives a minimum range of integers that must fit into these types, but it doesn't give a maximum . C 标准给出了必须适合这些类型的最小整数范围,但没有给出最大值 It's up to the implementation.这取决于实施。 See https://en.wikipedia.org/wiki/C_data_types#Main_typeshttps://en.wikipedia.org/wiki/C_data_types#Main_types

A modern system has native support for 4 sizes of integer: 1 byte, 2 bytes, 4 bytes, 8 bytes.现代系统原生支持 4 种大小的 integer:1 字节、2 字节、4 字节、8 字节。

So you can see that in order to map 5 types onto 4 sizes, two of the types must map to the same size.所以你可以看到,为了将 map 5 种类型转换为 4 种尺寸,其中两种类型必须 map 为相同的尺寸。

Linux and MacOS choose to have int be 4 bytes and long and long long both be 8 bytes. Linux 和 MacOS 选择int为 4 字节, longlong long均为 8 字节。 Windows chooses to have int and long both be 4 bytes, and long long be 8 bytes. Windows 选择intlong均为 4 字节, long long为 8 字节。 See https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models请参阅https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models

If the code is written to assume that long and long long are the same size and can be used interchangeably, then you'll get errors like the ones you're seeing when you try to compile it on Windows.如果编写代码时假定longlong long的大小相同并且可以互换使用,那么您将得到类似于在 Windows 上编译时所看到的错误。

暂无
暂无

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

相关问题 我正在尝试在我的 class 中创建一个 static 成员,但编译器警告我它未定义 - I'm trying to make a static member in my class but compiler is giving me warning that it is undefined 我正在尝试使我的二维数组程序获取每一行中的最大元素,但是它不起作用 - I'm trying to make my 2-D Array program to get the largest element in each row but its not working 我正在尝试将 DMA 数组及其大小作为参数传递,但它给出了错误 - I am trying to pass an DMA array and its size as an argument but it is giving an error 我正在尝试实现一个具有无限节点的树,但它给出了 SEGMENTATION FAULT 作为错误? - I am trying to implement a tree with infinite nodes but its giving SEGMENTATION FAULT as an error? 我正在尝试使用回溯解决 N 皇后问题,但在编译时它给出了运行时错误(动态堆栈缓冲区溢出) - I am trying to solve the N queen problem using backtracking but on compilation its giving the runtime error (dynamic-stack-buffer-overflow) 我是 C++ 的新手,我得到了这个错误帮助。 我很确定这是一个简单的解决方法,但我查找的答案没有意义 - I'm new to C++ and I got this error help. I'm pretty sure its an easy fix but the answers i looked up didn't make sense 使用此代码时,我总是收到错误消息。 我正在尝试在继承的类中使用构造函数。 C ++ - I keep getting an error when I use this code. I'm trying to use constructors in an inherited class. c++ 我正在尝试使用 c++ 使用 LDAP 扩展操作启动 tls。但是在执行启动 tls 扩展后我无法进行简单绑定 - I'm trying to use the LDAP extended operation start tls using c++. But after executing the start tls extension i'm unable to make the simple bind 我正在尝试在Windows上的android studio中运行一个基本的Android-NDK项目,但不断收到未知文件错误 - I'm trying to run a basic Android-NDK project in android studio on windows but keep getting unknown file error 我对 C++ 很陌生,而且我一直在尝试制作循环 - I'm very new to C++ and I'm stuck trying to make a loop
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM