gpt4 book ai didi

c++ - 将brew安装的库包含到XCode中

转载 作者:行者123 更新时间:2023-11-30 16:07:10 26 4
gpt4 key购买 nike

我正在尝试使用 Raylib 创建游戏。我想使用 XCode,因为我认为库管理会像 Windows 上的 Visual Studio 一样简单。

我使用 brew install raylib 安装了该库。现在我尝试运行这个从 Raylib 网站复制的简单项目。

main.c:

#include "raylib.h"
#include <stdio.h>

int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;

InitWindow(screenWidth, screenHeight, "raylib [core] example - keyboard input");

Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };

SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------

// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_RIGHT)) ballPosition.x += 2.0f;
if (IsKeyDown(KEY_LEFT)) ballPosition.x -= 2.0f;
if (IsKeyDown(KEY_UP)) ballPosition.y -= 2.0f;
if (IsKeyDown(KEY_DOWN)) ballPosition.y += 2.0f;
//----------------------------------------------------------------------------------

// Draw
//----------------------------------------------------------------------------------
BeginDrawing();

ClearBackground(RAYWHITE);

DrawText("move the ball with arrow keys", 10, 10, 20, DARKGRAY);

DrawCircleV(ballPosition, 50, MAROON);

EndDrawing();
//----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

return 0;
}

我包括了搜索路径和标题路径,如下图所示:

enter image description here

代码构建得很好,但没有启动终端 session ,也没有抽出球。您还可以在图片中看到库未加载,但我不明白为什么。我还制作了我包含的库和框架的屏幕截图:

enter image description here

如有任何帮助,我们将不胜感激。

最佳答案

通过查找this post解决了这个问题

我刚刚从项目中删除了库验证。

关于c++ - 将brew安装的库包含到XCode中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59741236/

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