Compilation error on example "multiple"

未关闭 适合新手
#425 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
cmake, cpp
领域
build-system

调研方向

从 examples/CMakeLists.txt 中 multiple 示例的 add_executable 声明开始,使用文档中记录的 cmake 和 make 命令复现失败。检查目标名称如何与 multiple 源代码目录冲突,然后进行能够避免该冲突的最小名称或配置更改。multiple 示例成功链接且构建完成即表示完成。

由索引模型根据 Issue 内容生成。

描述

Hi,

Running on linux ubuntu 25.10

This is my first contact with the project, so I might have made some mistake.

Went through the short procedure for testing the install.

git clone https://github.com/RobLoach/raylib-cpp.git
cd raylib-cpp
mkdir build
cd build
cmake ..
make

Couldn't get further as the build failed on the multiple example link, with the error:

[ 95%] Linking CXX executable multiple
/usr/bin/ld: cannot open output file multiple: est un dossier

"output file multiple: est un dossier" translates to something like "output file multiple: is a directory"

Went to examples/CMakeLists.txt, which on lines 57-59 reads like:

# Multiple Files Example
add_executable("multiple" multiple/main.cpp multiple/Player.cpp)
target_link_libraries("multiple" PUBLIC raylib_cpp raylib)

This creates a multiple executable file in the examples/CMakeFiles/multiple.dir/ which already contains a multiple directory for the generated objects, hence the conflict.

Not being a cmake expert, I've had hard times finding how to resolve the problem except by changing one of the names involved, meaning, either the source directory name or target executable.

Being lazy straight, I changed the executable target name to mooltiple (in reference to the mooltipass https://www.youtube.com/watch?v=yQMpfII_Jjw).

Not being an expert, I can't exactly tell if I've been just doing things wrong from the start, and I guess there might be a better solution (or name at least), but made it work for me. Not feeling confident enough to make a PR though. So just let you know, in case there is a real problem and you have a better idea.

Anyway, thanks for the project, this is cool :)

主要语言
C++
星标
960
派生
120
平均合并
10 分钟
30 天内合并 PR
1

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RobLoach/raylib-cpp 的其他 Issue

查看 RobLoach/raylib-cpp 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。