gpt4 book ai didi

c++ - 使用外部库(GEGELATI)时出现问题

转载 作者:行者123 更新时间:2023-12-02 10:04:13 26 4
gpt4 key购买 nike

最近,我开始学习有关机器学习的知识,并在Visual Studio中下载了与之兼容的库:C++的GEGELATI。链接到库:https://github.com/gegelati/gegelati。我还从同一页面下载了示例“stick-game”。我遵循所有要点来构建库和示例,但是会引发错误:“找不到gegelati.h”。当我看到它时,我记得在项目中构建库时“cmake ..”命令给我的建议:

*CMake Warning at CMakeLists.txt:68 (find_package):
By not providing "FindGEGELATI.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "GEGELATI",
but CMake did not find one.

找不到“GEGELATI”提供的软件包配置文件
以下名称之一:
GEGELATIConfig.cmake
gegelati-config.cmake

将安装前缀“GEGELATI”添加到CMAKE_PREFIX_PATH或进行设置
“GEGELATI_DIR”到包含上述文件之一的目录。如果
“GEGELATI”提供了单独的开发包或SDK,请确保它具有
已安装。*

如果您需要知道,这是我的CMakeList.txt中的代码: https://drive.google.com/file/d/1hDkC6coCWaQNb1Cv1QzrJbUMucjYE68y/view?usp=sharing

为了解决该问题,我决定复制gegelati.h和GEGELATIConfig.cmake文件(从安装gegelati的文件夹中),但是当我再次尝试编译时,出现错误E1696;但是,当我尝试重新编译时,出现了错误。它无法打开gegelati.h。

最后,我尝试将gegelati文件直接放在“stick-game / lib / gegelatilib”文件夹中,
将其路径包含在“AdditionalIncludeDirectories”中。我为此贴了一张图片(抱歉,它是西类牙语的):

AdditionalIncludeDirectory

新程序输出向我抛出19个“LNK2019”错误和8个“LNK2001”错误。范例二:
Error  LNK2019  símbolo externo "public: unsigned int __thiscall Instructions::Set::getNbInstructions(void)const " (?getNbInstructions@Set@Instructions@@QBEIXZ) sin resolver al que se hace referencia en la función _main

Error LNK2001 símbolo externo "public: virtual class Learn::LearningEnvironment * __thiscall Learn::LearningEnvironment::clone(void)const " (?clone@LearningEnvironment@Learn@@UBEPAV12@XZ) sin resolver

另外,在一开始,当我安装doxygen以使用gegelati时,它会引发一些错误:
*Checking Build System
Generating doxygen documentation in C:/Users/Acel Guilts/gegelati/bin/doc
CUSTOMBUILD : warning : tag INPUT: input source 'C:/Users/Acel' does not exist [C:\Users\Acel Guilts\gegelati\bin\doc\d
oc.vcxproj]
CUSTOMBUILD : warning : tag INPUT: input source 'Guilts/gegelati/gegelatilib' does not exist [C:\Users\Acel Guilts\gege
lati\bin\doc\doc.vcxproj]
CUSTOMBUILD : warning : tag INPUT: input source 'C:/Users/Acel' does not exist [C:\Users\Acel Guilts\gegelati\bin\doc\d
oc.vcxproj]
CUSTOMBUILD : warning : tag INPUT: input source 'Guilts/gegelati/doc' does not exist [C:\Users\Acel Guilts\gegelati\bin
\doc\doc.vcxproj]
CUSTOMBUILD : error : source C:/Users/Acel is not a readable file or directory... skipping. [C:\Users\Acel Guilts\gegel
ati\bin\doc\doc.vcxproj]
CUSTOMBUILD : error : source Guilts/gegelati/gegelatilib is not a readable file or directory... skipping. [C:\Users\Ace
l Guilts\gegelati\bin\doc\doc.vcxproj]
CUSTOMBUILD : error : source C:/Users/Acel is not a readable file or directory... skipping. [C:\Users\Acel Guilts\gegel
ati\bin\doc\doc.vcxproj]
CUSTOMBUILD : error : source Guilts/gegelati/doc is not a readable file or directory... skipping. [C:\Users\Acel Guilts
\gegelati\bin\doc\doc.vcxproj]*

您是否有解决问题的想法?

最佳答案

Windows(x64)上最新版本的Microsoft Visual Studio的GEGELATI的安装过程可以通过以下步骤完成:

  • GEGELATI-APPS repository(或使用该库构建的任何其他应用程序)下载您选择的应用程序。
  • here下载GEGELATI库的最新二进制文件。确保选择页面底部的gegelatilib-x.y.z.zip
  • gegelatilib-x.y.z.zip的内容解压缩到应用程序的lib文件夹中。例如,对于stick-game应用程序,该文件夹将为stick-game/lib/gegelatilib-0.2.1,并且其中应包含以下子文件夹:binCMakedocincludelib
  • stick-game/bin文件夹中打开一个终端,只需键入:
      cmake ..
    这将产生以下输出:
    -- Building for: Visual Studio 16 2019
    -- Selecting Windows SDK version 10.0.18362.0 to target Windows 6.1.7601.
    -- The C compiler identification is MSVC 19.26.28806.0
    -- The CXX compiler identification is MSVC 19.26.28806.0
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/bin/Hostx64/x64/cl.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    Copy GEGELATI DLLs into <YOUR_PATH>/stick-game/bin
    -- Configuring done
    -- Generating done
    -- Build files have been written to: <YOUR_PATH>/stick-game/bin
  • 现在您可以通过打开stick-game/bin/stick-game.sln解决方案来打开项目。要从Visual Studio启动应用程序,请在解决方案资源管理器中右键单击stick-game项目,然后选择“设为启动项目”。

  • 或者
  • 仍在终端中,从bin目录:
    cmake --build . --target stick-game --config Release
    然后
    .\Release\stick-game.exe

  • 最好,
    卡罗尔

    关于c++ - 使用外部库(GEGELATI)时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61036598/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com