How can I fix this error on visual studio code?

154 Views Asked by At

I'm new to C and i'm trying to create a window in raylib, my compiler is clang, but it keeps on giving me an error that i need help fixing , here's my code :

#include "raylib.h"

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

    InitWindow(screenWidth, screenHeight, "raylib  example - basic window");

    SetTargetFPS(60);               
    
    // Main game loop
    while (!WindowShouldClose())    
    {
        BeginDrawing();
            ClearBackground(RAYWHITE);
            DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
        EndDrawing();
    }
    
    CloseWindow();        

    return 0;
} 

And it gives me this error :

Undefined symbols for architecture x86_64:
  "_BeginDrawing", referenced from:
      _main in raytest-8c368e.o
  "_ClearBackground", referenced from:
      _main in raytest-8c368e.o
  "_CloseWindow", referenced from:
      _main in raytest-8c368e.o
  "_DrawText", referenced from:
      _main in raytest-8c368e.o
  "_EndDrawing", referenced from:
      _main in raytest-8c368e.o
  "_InitWindow", referenced from:
      _main in raytest-8c368e.o
  "_SetTargetFPS", referenced from:
      _main in raytest-8c368e.o
  "_WindowShouldClose", referenced from:
      _main in raytest-8c368e.o
ld: symbol(s) not found for architecture x86_64

How to fix this???

0

There are 0 best solutions below