Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including brew installed library to XCode

Tags:

c++

c

xcode

macos

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.

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:

enter image description here

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:

enter image description here

Any help would be appreciated.

like image 234
HWilmer Avatar asked Sep 11 '25 10:09

HWilmer


1 Answers

Solved it by finding this post

I just removed the library validation form the project.

like image 62
HWilmer Avatar answered Sep 14 '25 01:09

HWilmer