【问题标题】:CMake + freeglut3: cannot find usbhid.hCMake + freeglut3:找不到 usbhid.h
【发布时间】:2016-05-10 17:01:49
【问题描述】:

系统:我在 Max OS 10.11.3 系统上使用 Linux Mint 17.3 作为 VB-Guest。

问题:我想编译freeglut3.0.0

问题:cmake 给我一个致命错误:usbhid.h: No such file or directory

你好,

问题是,即使在安装了所有依赖项之后,我也无法在我的系统上找到这个文件。经过研究,我发现它与一些 USB 驱动程序有关。难道它与没有“实际” USB 硬件的 VB 系统有关吗? 还是有我丢失的包裹。

我安装了 libgl1-mesa-dev、libx11-dev、libxrandr-dev 和 libxi-dev

这里我附上了 CMakeError.log

Determining if files usbhid.h exist failed with the following output:
Change Dir: /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec2451224769/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2451224769.dir/build.make CMakeFiles/cmTryCompileExec2451224769.dir/build
make[1]: Entering directory `/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2451224769.dir/CheckIncludeFiles.c.o
/usr/bin/cc   -Wall -pedantic    -o CMakeFiles/cmTryCompileExec2451224769.dir/CheckIncludeFiles.c.o   -c /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp/CheckIncludeFiles.c:2:20: fatal error: usbhid.h: No such file or directory
 #include <usbhid.h>
                    ^
compilation terminated.
make[1]: Leaving directory `/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec2451224769.dir/CheckIncludeFiles.c.o] Error 1
make: *** [cmTryCompileExec2451224769/fast] Error 2

Source:
/* */
#include <usbhid.h>


int main(){return 0;}

Determining if the function XParseGeometry exists failed with the following output:
Change Dir: /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec2875944840/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2875944840.dir/build.make CMakeFiles/cmTryCompileExec2875944840.dir/build
make[1]: Entering directory `/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /opt/freeglut-3.0.0/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2875944840.dir/CheckFunctionExists.c.o
/usr/bin/cc   -Wall -pedantic -DCHECK_FUNCTION_EXISTS=XParseGeometry   -o CMakeFiles/cmTryCompileExec2875944840.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-2.8/Modules/CheckFunctionExists.c
Linking C executable cmTryCompileExec2875944840
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2875944840.dir/link.txt --verbose=1
/usr/bin/cc   -Wall -pedantic -DCHECK_FUNCTION_EXISTS=XParseGeometry    CMakeFiles/cmTryCompileExec2875944840.dir/CheckFunctionExists.c.o  -o cmTryCompileExec2875944840 -rdynamic -lm 
CMakeFiles/cmTryCompileExec2875944840.dir/CheckFunctionExists.c.o: In function `main':
CheckFunctionExists.c:(.text+0x15): undefined reference to `XParseGeometry'
collect2: error: ld returned 1 exit status
make[1]: Leaving directory `/opt/freeglut-3.0.0/CMakeFiles/CMakeTmp'
make[1]: *** [cmTryCompileExec2875944840] Error 1
make: *** [cmTryCompileExec2875944840/fast] Error 2

我不知道如何为自己找到解决方案,所以我在这里问。

提前致谢

【问题讨论】:

    标签: c++ linux opengl cmake freeglut


    【解决方案1】:

    usbhid.h:请安装“libusbhid-dev”:$ sudo apt-get install libusbhid-dev


    【讨论】:

    • 我尝试了 sudo apt-get install libusbhid-dev 但收到“E:无法定位软件包 libusbhid-dev”错误。你能告诉我问题是什么吗?谢谢。
    • @User137481:您使用的是哪个“Linux 操作系统”? libusbhid-dev 是一个 freebsd 软件包。例子packages.debian.org/search?keywords=libusbhid-dev ...我猜你可以下载这个包,然后把标题usbhid.h插入,例如将文件复制到/usr/local/include/
    • 感谢您的回复。我解决了这个问题。我正在运行一个 32 位的 Ubuntu 桌面。所以,我安装了 32 位库。该应用程序正在寻找应该安装在不同文件夹中的 64 位库。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-19
    • 1970-01-01
    • 2016-04-14
    • 2021-07-23
    • 2011-08-20
    • 2018-01-20
    • 2023-03-28
    相关资源
    最近更新 更多