包括将brew安装的库包含到XCode [英] Including brew installed library to XCode

查看:40
本文介绍了包括将brew安装的库包含到XCode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用Raylib创建一个游戏.我想使用XCode,因为我认为库管理和Windows上的Visual Studio一样容易.

I am trying to create a Game with Raylib. I want to use XCode because I thought the Library Management would be as easy as with Visual Studio on Windows.

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

I installed the library with brew install raylib. Now I tried run this simple Project that I copied from the website of 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;
}

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

And I included the Search Path and Header Path as seen in the following picture:

该代码构建良好,但是没有启动终端会话,也没有绘制球.您还可以在图片中看到该库未加载,但是我不明白为什么.我还制作了包括的库和框架的屏幕截图:

The Code builds just fine, but no terminal session is started and no ball is drawn. You can see the in the picture also that the library is not loaded, but I don't understand why. I also made a screenshot of the libraries and frameworks I included:

任何帮助将不胜感激.

推荐答案

通过找到我刚刚从项目中删除了库验证.

I just removed the library validation form the project.

这篇关于包括将brew安装的库包含到XCode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆