The Ultimate Raylib gaming library wrapper for Nim

Overview

NimraylibNow! - The Ultimate Raylib wrapper for Nim

The most idiomatic and up-to-date wrapper for Raylib gaming C library. Use this library if you want to write games using Raylib in Nim.

Features

  • Automated generation of the wrapper for the latest version of Raylib using the power of (((Nim)))
  • Idiomatic Nim naming and conventions so you write Nim code, not C
  • 60+ examples converted from C to Nim
  • Includes modules: raylib, raymath, rlgl, raygui, physac
  • Conversion script is included in the library, no manual work is required to update the bindings*

*minor changes at most

Install Raylib

Windows

Download latest library from raylib releases page for MinGW compiler, for version 3.5.0 the name is raylib-3.5.0_win64_mingw-w64.zip. Extract it and make sure that files libraylibdll.a and raylib.dll are always in the same directory as your game .exe file.

Linux

Use your package manager, for example for Arch Linux:

$ sudo pacman -Syu raylib

Alternatively download latest library from raylib releases page, for version 3.5.0 the name is raylib-3.5.0_linux_amd64.tar.gz. Extract it and put all .so files into /usr/local/lib.

MacOS

With brew package manager:

$ brew install raylib

Alternatively download latest library from raylib releases page, for version 3.5.0 the name is raylib-3.5.0_macos.tar.gz. Extract it and put all .dylib files into /usr/local/lib.

Install NimraylibNow!

Install this library with nimble (takes 6-10(!) minutes, fix is on the way):

$ nimble install nimraylib_now

Or put it into your .nimble file:

requires "nimraylib_now"

How to use

Import any necessary modules and use it:

import nimraylib_now/raylib
import nimraylib_now/[raylib, raymath, raygui]
from nimraylib_now/rlgl as rl import nil  # import rlgl with a mandatory prefix rl

See examples for how to use it. You should generally be able to follow any tutorials for official C bindings, just mind the naming. Also see official cheatsheet and directly inspect the binding sources, e.g. for raylib.

Here is a long example to showcase most features (crown.nim).

import math
import nimraylib_now/raylib

const
  nimFg: Color = (0xff, 0xc2, 0x00)          # Use this shortcut with alpha = 255!
  nimBg: Color = (0x17, 0x18, 0x1f)

# Let's draw a Nim crown!
const
  crownSides = 8                             # Low-polygon version
  centerAngle = 2.0 * PI / crownSides.float  # Angle from the center of a circle
  lowerRadius = 2.0                          # Lower crown circle
  upperRadius = lowerRadius * 1.4            # Upper crown circle
  mainHeight = lowerRadius * 0.8             # Height without teeth
  toothHeight = mainHeight * 1.3             # Height with teeth
  toothSkew = 1.2                            # Little angle for teeth

var
  lowerPoints, upperPoints: array[crownSides, tuple[x, y: float]]

# Get evenly spaced points on the lower and upper circles,
# use Nim's math module for that
for i in 0..<crownSides:
  let multiplier = i.float
  # Formulas are for 2D space, good enough for 3D since height is always same
  lowerPoints[i] = (
    x: lowerRadius * cos(centerAngle * multiplier),
    y: lowerRadius * sin(centerAngle * multiplier),
  )
  upperPoints[i] = (
    x: upperRadius * cos(centerAngle * multiplier),
    y: upperRadius * sin(centerAngle * multiplier),
  )

initWindow(800, 600, "[nim]RaylibNow!")  # Open window

var camera = Camera(
  position: (5.0, 8.0, 10.0),  # Camera position
  target: (0.0, 0.0, 0.0),     # Camera target it looks-at
  up: (0.0, 1.0, 0.0),         # Camera up vector (rotation over its axis)
  fovy: 45.0,                  # Camera field-of-view apperture in Y (degrees)
  type: Perspective            # Defines projection type, see CameraType
)
camera.setCameraMode(Orbital)  # Several modes available, see CameraMode

var pause = false              # Pausing the game will stop animation

setTargetFPS(60)               # Set the game to run at 60 frames per second

# Wait for Esc key press or when the window is closed
while not windowShouldClose():
  if not pause:
    camera.addr.updateCamera   # Rotate camera

  if isKeyPressed(Space):      # Pressing Space will stop/resume animation
    pause = not pause

  beginDrawing:                # Use drawing functions inside this block
    clearBackground(RayWhite)  # Set background color

    beginMode3D(camera):       # Use 3D drawing functions inside this block
      drawGrid(10, 1.0)

      for i in 0..<crownSides:
        # Define 5 points:
        # - Current lower circle point
        # - Current upper circle point
        # - Next lower circle point
        # - Next upper circle point
        # - Point for peak of crown tooth
        let
          nexti = if i == crownSides - 1: 0 else: i + 1
          lowerCur: Vector3 = (lowerPoints[i].x, 0.0, lowerPoints[i].y)
          upperCur: Vector3 = (upperPoints[i].x, mainHeight, upperPoints[i].y)
          lowerNext: Vector3 = (lowerPoints[nexti].x, 0.0, lowerPoints[nexti].y)
          upperNext: Vector3 = (upperPoints[nexti].x, mainHeight, upperPoints[nexti].y)
          tooth: Vector3 = (
            (upperCur.x + upperNext.x) / 2.0 * toothSkew,
            toothHeight,
            (upperCur.z + upperNext.z) / 2.0 * toothSkew
          )

        # Front polygon (clockwise order)
        drawTriangle3D(lowerCur, upperCur, upperNext, nimFg)
        drawTriangle3D(lowerCur, upperNext, lowerNext, nimFg)

        # Back polygon (counter-clockwise order)
        drawTriangle3D(lowerCur, upperNext, upperCur, nimBg)
        drawTriangle3D(lowerCur, lowerNext, upperNext, nimBg)

        # Wire line for polygons
        drawLine3D(lowerCur, upperCur, Gray)

        # Crown tooth front triangle (clockwise order)
        drawTriangle3D(upperCur, tooth, upperNext, nimFg)

        # Crown tooth back triangle (counter-clockwise order)
        drawTriangle3D(upperNext, tooth, upperCur, nimBg)

    block text:
      block:
        let
          text = "I AM NIM"
          fontSize = 60
          textWidth = measureText(text, fontSize)
          verticalPos = (getScreenHeight().float * 0.4).int
        drawText(
          text,
          (getScreenWidth() - textWidth) div 2,  # center
          (getScreenHeight() + verticalPos) div 2,
          fontSize,
          Black
        )
      block:
        let text =
          if pause: "Press Space to continue"
          else: "Press Space to pause"
        drawText(text, 10, 10, 20, Black)

closeWindow()

Nim crown drawn with polygons

Naming differences with C

Naming is converted to more Nim conventional style but in a predictable manner. Generally just omit any prefixes you see in official docs and use camelCase for procs, everything else stays the same:

void InitWindow(int width, int height, const char *title);
void GuiSetState(int state);
void rlBegin(int mode);

to

proc initWindow*(width: cint; height: cint; title: cstring)
proc setState*(state: cint)
proc begin*(mode: cint)

Although some definitions may have names like FULLSCREEN_MODE, you can still use them (and encouraged to) as FullscreenMode in code.

Raymath

All prefixes specific to types were omitted where possible:

Vector2 Vector2Zero(void)
Vector3 Vector3Zero(void)

Vector2 Vector2Add(Vector2 v1, Vector2 v2)
Vector3 Vector3Add(Vector3 v1, Vector3 v2)

to

proc vector2Zero*(): Vector2
proc vector3Zero*(): Vector3

proc add*(v1: Vector2; v2: Vector2): Vector2
proc add*(v1: Vector3; v2: Vector3): Vector3

Passing values by addresses

BE VERY CAREFUL with values which are passed as addresses, always convert them to approapriate C-compatible types:

# Will do incorrect things!
var
  xPos = 0.0  # this is `float` type, will not be converted to `cfloat` automatically
  cameraPos = [xPos, camera.position.y, camera.position.z]
setShaderValue(shader, viewEyeLoc, cameraPos.addr, Vec3)  # cameraPos.addr is a pointer

# Convert values instead
var xPos: cfloat = 0.0
# or
var cameraPos = [xPos.cfloat, camera.position.y, camera.position.z]
# So this finally works as intended:
setShaderValue(shader, viewEyeLoc, cameraPos.addr, Vec3)

Tips and tricks

Tuple to object converters for geometry

Vector2, Vector3, Vector4 (Quaternion), Matrix, Rectangle, Color can be written as a tuple to save on typing as they have pretty much standard parameter sequence:

# All are valid:
var
  v1: Vector2 = (x: 3.0, y: 5.0)
  v2 = Vector2(x: 3.0, y: 5.0)
  v3 = (3.0, 5.0)
  c: Color = (0xc9, 0xc9, 0xc9)  # color can be written as a tuple even without the alpha value!

Require fully qualified procs

For functions operating on global scope it could be convenient to use fully qualified proc name:

rlgl.begin(rlgl.Triangles)
# draw something
rlgl.end()

which can be enforced by compiler by importing rlgl module like this:

from nimraylib_now/rlgl import nil

# or to use a shorter `rl`
from nimraylib_now/rlgl as rl import nil

Begin-End pairs sugar

There are pairs like beginDrawing() - endDrawing(), each have helping templates to automatically insert end-proc at the end:

beginDrawing:
  drawLine(...)

is same as

beginDrawing()
drawLine(...)
endDrawing()

Reserved words

Be careful when using fields or functions which are also reserved words in Nim:

camera.`type` = CameraType.Perspective

Enums

All enums are marked as {.pure.} which means they should be fully qualified when compiler can't guess their type:

camera.`type` = Perspective      # can be guessed, no need for CameraType.Perspective
if isKeyDown(Right):             # can be guessed, no need for KeyboardKey.Right
if KeyboardKey.Right.isKeyDown:  # cannot be guessed

Raymath infix operators

You can use infix operators like +, -, *, / for operations on vectors, matrices and quaternions:

let
  v1 = Vector3(x: 5, y: 2, z: 1)
  v2 = Vector3(x: 3, y: 0, z: 0)
assert v1 - v2 == Vector3(x: 2.0, y: 2.0, z: 1.0)

How wrapping works

nimble convert runs src/converter.nim script and checks that the resulting files are valid Nim files.

There are 4 steps during conversion:

  1. Get C header files
  2. Modify C header files (preprocessing)
  3. Run c2nim on modified C header files (processing)
  4. Modify resulting Nim files (postprocessing)

Since every step is done automatically, updating to the next version should be a comparatively easy task.

How to update this library

$ git clone --recurse-submodules --shallow-submodules https://github.com/greenfork/nimraylib_now
$ cd nimraylib_now
$ nimble install --depsOnly
$ nimble install c2nim
$ git checkout master
$ cat .gitmodules  # let's see which submodules might need updating
# For every submodule do the following; here we will only do it for "raylib"
$ cd raylib
$ git pull
$ git fetch --tags
$ git tag --list
# Here you can choose any desired version or just stay at latest master
$ git checkout 3.5.0
$ cd ..
$ nimble convert
$ git diff  # review changes
$ nimble testExamples  # make sure every example still compiles
# Edit nimraylib_now.nimble file and change version according to [semver]
# Assume that the edited version is now 1.2.0
$ git commit --all --verbose
$ git tag -a v1.2.0  # version 1.2.0 is from nimble file earlier
$ git push --all

Contribute

Any ideas are welcome. Open an issue to ask a question or suggest an idea.

Documentation

Any ideas on how to improve documentation are welcome!

Convert examples

You can help by converting missing examples from original C library doing the following:

  1. Find a missing example in C, you can use helper script for that: nim r tools/find_missing_examples.nim.
  2. Compile and run tools/c2nim_example_converter.nim on this C file, it helps with conversion.
  3. Edit resulting Nim file, make sure it runs.
  4. Put this file into a correct category in examples (original is for self-developed examples).
  5. Compile and run tools/make_tests_from_examples.nim without any arguments, it should create a test file in tests/examples/yourcategory.
  6. Run nimble testExamples and make sure that your example passes the test. If it doesn't pass the test, create an issue or ask me any other way, I will help.

I cannot port a number of examples:

  • core_drop_files.c - I can't test it on my machine (Wayland on Linux)
  • core_input_gamepad.c - I don't have a gamepad
  • core_input_multitouch.c - probably requires a phone to test it?
  • core_storage_values.c - I can't compile the original C example, values are reset to 0,0 when I press Space
  • core_basic_window_web.c - need emscripten dev tools

Work on converter script

If something is broken or you see an opportunity to improve the wrapper, you can help with converter script.

Clone and run tests:

$ git clone --recurse-submodules --shallow-submodules https://github.com/greenfork/nimraylib_now
$ cd nimraylib_now
$ nimble install --depsOnly
$ nimble install c2nim
$ nimble convert
$ nimble testExamples

Then workflow is as follows:

  1. Change src/converter.nim file
  2. Run nimble convert and see if you achieved desired changes
  3. Run nimble testExamples to see that all examples are still compiled

Troubleshooting

Freezes on Wayland

Random freezes when everything stops being responsive can be caused by glfw compiled against Wayland library. Try X11 version of glfw.

GLFW is a raylib dependency that was installed by your package manager, you can uninstall raylib with clearing all of its dependencies and install it again choosing X11 version of glfw.

Windows error: The application was unable to start correctly (0x00000007b)

Or similar errors which point to missing libwinpthread-1.dll file mean that you do not have path set correctly and MinGW can't find correct library files.

Make sure to include MinGW's bin folder in your PATH. The path to MinGW's bin folder looks something like this by default: C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin.

Thanks

Many thanks to V.A. Guevara for the efforts on Raylib-Forever library which was the initial inspiration for this library.

Thanks to Nim community, it's very nice to get the answers to questions rather quickly.

License

MIT licensed, see LICENSE.md.

Comments
  • Windows progress

    Windows progress

    First off, thank you for your wonderful work! I've been tinkering on Windows with this, and anything that requires raylib.dll works, atleast the samples I tried. I'll be playing with this more!

    1. Download the Windows release from: https://github.com/raysan5/raylib/releases, but don't choose the installer, choose the other one, like for the 3.5.0 release you download: raylib-3.5.0_win64_mingw-w64.zip if you are on a 64bits system or raylib-3.5.0_win32_mingw-w64.zip if you are on a 32bits system.
    2. In the downloaded archive there is a /lib folder in there you'll find raylib.dll, put this dll in the same folder as your resulting .exe file.

    So say we want to run this https://github.com/greenfork/nimraylib_now/blob/master/examples/shapes/bouncing_ball.nim example. cd yourself into the folder, run nim c -r .\bouncing_ball.nim and make sure the dll is in the same folder, and you'll find yourself seeing this:

    screenshot_20210110_143702

    Current issues

    Testing doesn't work

    Running nimble testExamples gives the following error

    PS P:\dev\gamedev\nimraylib_now> nimble testExamples
      Executing task testExamples in P:\dev\gamedev\nimraylib_now\nimraylib_now.nimble
    no tests were found for pattern: 'tests/examples/**/*.nim'
    

    Maybe this is has to do with how paths are handled differently on Windows and Linux?

    Raygui

    I downloaded raygui.dll from your release page, put it next to raylib.dll but the example still fails with: could not load: raygui.dll Running buildRaygui gives me the following error:

      Executing task buildRaygui in P:\dev\gamedev\nimraylib_now\nimraylib_now.nimble
    stack trace: (most recent call last)
    C:\Users\Rishi\AppData\Local\Temp\nimblecache-0\nimscriptapi_2903036856.nim(187, 16)
    P:\dev\gamedev\nimraylib_now\nimraylib_now.nimble(26, 8) buildRayguiTask
    C:\Users\Rishi\.choosenim\toolchains\nim-1.4.2\lib\system\nimscript.nim(186, 19) exec
    C:\Users\Rishi\.choosenim\toolchains\nim-1.4.2\lib\system\nimscript.nim(186, 19) Error: unhandled exception: The system cannot find the file specified.
     [OSError]
         Error: Exception raised during nimble script execution
    

    This might have to do with me not having raygui.o anywhere. I'll try to troubleshoot this tonight or tomorrow.

    opened by zetashift 15
  • NixOS: GLFW: Error: 65542 Description: GLX: Failed to load GLX

    NixOS: GLFW: Error: 65542 Description: GLX: Failed to load GLX

    No window comes up when I try to run my program (which uses nimraylib_now of couse). I get this error:

    > nimble run          
      Verifying dependencies for [email protected]
          Info: Dependency on nimraylib_now@any version already satisfied
      Verifying dependencies for [email protected]
          Info: Dependency on regex@any version already satisfied
      Verifying dependencies for [email protected]
          Info: Dependency on unicodedb@>= 0.7.2 already satisfied
      Verifying dependencies for [email protected]
       Building snekim/snekim using c backend
    INFO: Initializing raylib 4.2
    INFO: Supported raylib modules:
    INFO:     > rcore:..... loaded (mandatory)
    INFO:     > rlgl:...... loaded (mandatory)
    INFO:     > rshapes:... loaded (optional)
    INFO:     > rtextures:. loaded (optional)
    INFO:     > rtext:..... loaded (optional)
    INFO:     > rmodels:... loaded (optional)
    INFO:     > raudio:.... loaded (optional)
    WARNING: GLFW: Error: 65542 Description: GLX: Failed to load GLX
    WARNING: GLFW: Failed to initialize Window
    FATAL: Failed to initialize Graphic Device
    

    We already checked in the raylib discord that it's not a fault of my hardware or drivers.

    bug help wanted 
    opened by auroraanna 14
  • Building conflicts with windows.h for some users

    Building conflicts with windows.h for some users

    This is only relevant for SOME Nim installations, so far no clue why.

    https://github.com/raysan5/raylib/issues/1217

    For some reason in some cases Nim installation on Windows tries to compile windows.h file together with the rest of the program which causes name clashes in type definitions such as Rectangle and others. In the raylib thread there are several solutions. Another solution would be to ask Nim to NOT include windows.h file during build.

    Someone needs to do that thing for me, so far I don't have a windows machine.

    help wanted windows 
    opened by greenfork 14
  • Example compilation fails after fresh nimble install (Windows).

    Example compilation fails after fresh nimble install (Windows).

    Freshly installed using nimble, and then tried to compile crown.nim with the example compiler arguments, but it threw this error message:

    Hint: used config file 'X:\Program Files (x86)\nim-1.4.8\config\nim.cfg' [Conf]
    Hint: used config file 'X:\Program Files (x86)\nim-1.4.8\config\config.nims' [Conf] .................................CC: rglfw CC: shapes CC: textures CC: text gcc.exe: error: User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled: No such file or directory CC utils gcc.exe: error: gcc.exe:User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include: No such file or directory gcc.exe:error: User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled: No such file or directory C:error: m delUser.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\deps\mingw: No such file or directory gcc.exe:s gcc.exe: error: error: User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include: No such file or directory User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled: No such file or directory gcc.exe: gcc.exe:error: gcc.exe: C C: error: audio User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include: No such file or directory error: User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled: No such file or directory gcc.exe: gcc.exe:User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\deps\mingw: No such file or directory error: CUser.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include: No such file or directory Cerror: : o e User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled: No such file or directory gcc.exe: gcc.exe:error: User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\deps\mingw: No such file or directory error: User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include: No such file or directory gcc.exe: Er or:error: xUser.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\deps\mingw: No such file or directory ecution gcc.exe:of an ex ererror: n l cUser.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled: No such file or directory ompile progragcc.exe:gcc.exe: g c c e error: e -c User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include: No such file or directory -User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled: No such file or directory w fmgcc.exe: x gcc.exe:e r rerror: s= error: mgcc.exe:User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\deps\mingw: No such file or directory User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include: No such file or directory o- ms igcc.exe:terror: i l ds -DWIN3User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled: No such file or directory error: 2 LEA N_Agcc.exe:ND_MEA N Wallerror: D_User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include: No such file or directory DEFAUL _SOgcc.exe:U CE -Wn o- issing-braces -Werror=pointeerror: r- rith -fno-strict-aliasing -std=c99 -s User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\deps\mingw: No such file or directory
    -O1 -Werror=implicit-function-declaration -IC:\Users\User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled -IC:\Users\User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\include -IC:\Users\User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\external\glfw\deps\mingw -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -DPHYSAC_IMPLEMENTATION -DPHYSAC_NO_THREADS -DRAYGUI_IMPLEMENTATION -O3 -fno-strict-aliasing -fno-ident -I"X:\Program Files (x86)\nim-1.4.8\lib" -I"C:\Users\User\Desktop\Coding Projects\Stocks" -o "C:\Users\User\nimcache\crown_r\rglfw.c.o" "C:\Users\User.nimble\pkgs\nimraylib_now-0.13.1\csources\raylib_mangled\rglfw.c"' failed with exit code: 1

    (Not sure how to interpret this error, but I'll try installing the prebuilt binaries instead).

    opened by idakandrew 13
  • loadMusicStream() is not working in html5

    loadMusicStream() is not working in html5

    Probably,loadMusicStream() file loading is failed in emscripten build. This is bug report in Chrome. 185789143-87e98f09-358f-4446-be79-9daeeb25463f

    wav and mp3 are also failed. And desktop(windows10) build is already succeeded in same code.

    opened by tiki48 12
  • Text doesn't show up on crown.nim example

    Text doesn't show up on crown.nim example

    Nim version is 1.4.2 Raylib version is 3.5.0 Linux distro : Pop!_OS 20.04 LTS x86_64

    After compiling and launching the crown.nim example, I noticed the text drawing doesn't seem to work on my side. "Press Space to pause" and "I AM NIM" doesn't show up anywhere on the screen. All the rest is drawn and displayed perfectly on screen. crown

    INFO: Initializing raylib 3.5
    INFO: DISPLAY: Device initialized successfully
    INFO:     > Display size: 3440 x 1440
    INFO:     > Render size:  800 x 600
    INFO:     > Screen size:  800 x 600
    INFO:     > Viewport offsets: 0, 0
    INFO: GLAD: OpenGL extensions loaded successfully
    INFO: GL: OpenGL 3.3 Core profile supported
    INFO: GL: OpenGL device information:
    INFO:     > Vendor:   NVIDIA Corporation
    INFO:     > Renderer: GeForce RTX 2060/PCIe/SSE2
    INFO:     > Version:  3.3.0 NVIDIA 455.38
    INFO:     > GLSL:     3.30 NVIDIA via Cg compiler
    INFO: GL: Supported extensions count: 395
    INFO: GL: DXT compressed textures supported
    INFO: GL: ETC2/EAC compressed textures supported
    INFO: GL: Anisotropic textures filtering supported (max: 16X)
    INFO: GL: Mirror clamp wrap texture mode supported
    INFO: TEXTURE: [ID 1] Texture created successfully (1x1 - 1 mipmaps)
    INFO: TEXTURE: [ID 1] Default texture loaded successfully
    INFO: SHADER: [ID 1] Compiled successfully
    INFO: SHADER: [ID 2] Compiled successfully
    INFO: SHADER: [ID 3] Program loaded successfully
    INFO: SHADER: [ID 3] Default shader loaded successfully
    INFO: RLGL: Internal vertex buffers initialized successfully in RAM (CPU)
    INFO: RLGL: Render batch vertex buffers loaded successfully
    INFO: RLGL: Default state initialized successfully
    INFO: TEXTURE: [ID 2] Texture created successfully (128x128 - 1 mipmaps)
    INFO: FONT: Default font loaded successfully
    INFO: TIMER: Target time per frame: 16.667 milliseconds
    INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
    INFO: TEXTURE: [ID 1] Unloaded default texture data from VRAM (GPU)
    INFO: Window closed successfully
    

    EDIT : i also tried to compile one of the text examples (text_format_text.nim), still doesn't work.

    opened by RationalG 11
  • Ubuntu: collect2: error: ld returned 1 exit status

    Ubuntu: collect2: error: ld returned 1 exit status

    I might have set things up wrong. OS: Pop_Os! 20.10 (basically ubuntu)

    I build and installed raylib according to these instructions: https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux#build-raylib-using-cmake (using cmake -DSHARED=ON)

    Running an example like nim c -r shapes_bouncing_ball.nim gives me the following big error:

    Warning huge log
     nim c -r shapes_bouncing_ball.nim 
    Hint: used config file '/home/rishi2/.choosenim/toolchains/nim-1.4.2/config/nim.cfg' [Conf]
    Hint: used config file '/home/rishi2/.choosenim/toolchains/nim-1.4.2/config/config.nims' [Conf]
    ....................CC: ../../src/nimraylib_now/raylib.nim
    
    Hint:  [Link]
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector2Length':
    /home/rishi2/dev/raylib/src/raymath.h:221: undefined reference to `sqrtf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector2Distance':
    /home/rishi2/dev/raylib/src/raymath.h:242: undefined reference to `sqrtf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector2Angle':
    /home/rishi2/dev/raylib/src/raymath.h:249: undefined reference to `atan2f'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector2Rotate':
    /home/rishi2/dev/raylib/src/raymath.h:317: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:317: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:317: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:317: undefined reference to `cosf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector2MoveTowards':
    /home/rishi2/dev/raylib/src/raymath.h:331: undefined reference to `sqrtf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector3Length':
    /home/rishi2/dev/raylib/src/raymath.h:435: undefined reference to `sqrtf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector3Distance':
    /home/rishi2/dev/raylib/src/raymath.h:459: undefined reference to `sqrtf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector3Min':
    /home/rishi2/dev/raylib/src/raymath.h:567: undefined reference to `fminf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:568: undefined reference to `fminf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:569: undefined reference to `fminf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `Vector3Max':
    /home/rishi2/dev/raylib/src/raymath.h:579: undefined reference to `fmaxf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:580: undefined reference to `fmaxf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:581: undefined reference to `fmaxf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `MatrixRotate':
    /home/rishi2/dev/raylib/src/raymath.h:859: undefined reference to `sqrtf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:869: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:870: undefined reference to `cosf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `MatrixRotateX':
    /home/rishi2/dev/raylib/src/raymath.h:901: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:902: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `MatrixRotateY':
    /home/rishi2/dev/raylib/src/raymath.h:917: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:918: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `MatrixRotateZ':
    /home/rishi2/dev/raylib/src/raymath.h:933: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:934: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `MatrixRotateXYZ':
    /home/rishi2/dev/raylib/src/raymath.h:950: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:951: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:952: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:953: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:954: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:955: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `MatrixPerspective':
    /home/rishi2/dev/raylib/src/raymath.h:1031: undefined reference to `tan'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `QuaternionLength':
    /home/rishi2/dev/raylib/src/raymath.h:1165: undefined reference to `sqrt'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `QuaternionSlerp':
    /home/rishi2/dev/raylib/src/raymath.h:1278: undefined reference to `acosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1279: undefined reference to `sqrtf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1290: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1291: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `QuaternionFromMatrix':
    /home/rishi2/dev/raylib/src/raymath.h:1332: undefined reference to `sqrtf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1341: undefined reference to `sqrtf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1349: undefined reference to `sqrtf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `QuaternionFromAxisAngle':
    /home/rishi2/dev/raylib/src/raymath.h:1396: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1397: undefined reference to `cosf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `QuaternionToAxisAngle':
    /home/rishi2/dev/raylib/src/raymath.h:1415: undefined reference to `acosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1416: undefined reference to `sqrtf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `QuaternionFromEuler':
    /home/rishi2/dev/raylib/src/raymath.h:1440: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1441: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1442: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1443: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1444: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1445: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `QuaternionToEuler':
    /home/rishi2/dev/raylib/src/raymath.h:1464: undefined reference to `atan2f'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1470: undefined reference to `asinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/raymath.h:1475: undefined reference to `atan2f'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `rlGenerateMipmaps':
    /home/rishi2/dev/raylib/src/rlgl.h:2466: undefined reference to `log'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/rlgl.h:2466: undefined reference to `floor'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `GenTexturePrefilter':
    /home/rishi2/dev/raylib/src/rlgl.h:3676: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/rlgl.h:3677: undefined reference to `powf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `SetVrConfiguration':
    /home/rishi2/dev/raylib/src/rlgl.h:3887: undefined reference to `atan2f'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `SetCameraMode':
    /home/rishi2/dev/raylib/src/camera.h:257: undefined reference to `sqrtf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:260: undefined reference to `atan2f'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:261: undefined reference to `sqrtf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:261: undefined reference to `atan2f'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `UpdateCamera':
    /home/rishi2/dev/raylib/src/camera.h:388: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:388: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:388: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:389: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:390: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:390: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:390: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:395: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:395: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:396: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:397: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:397: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:409: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:409: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:410: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:410: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:411: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:411: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:416: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:417: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:418: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:419: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:421: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:422: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:425: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:426: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:427: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:428: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:452: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:454: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:455: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o):/home/rishi2/dev/raylib/src/camera.h:460: more undefined references to `sinf' follow
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `UpdateCamera':
    /home/rishi2/dev/raylib/src/camera.h:462: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:463: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:465: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:466: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:469: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:470: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:471: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:472: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:489: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:489: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:491: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:491: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:492: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:492: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:494: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/camera.h:494: undefined reference to `cosf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `BeginMode3D':
    /home/rishi2/dev/raylib/src/core.c:1888: undefined reference to `tan'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `GetFPS':
    /home/rishi2/dev/raylib/src/core.c:2180: undefined reference to `roundf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(core.c.o): in function `SetupFramebuffer':
    /home/rishi2/dev/raylib/src/core.c:4098: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/core.c:4104: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/core.c:4139: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/core.c:4145: undefined reference to `round'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawLineEx':
    /home/rishi2/dev/raylib/src/shapes.c:129: undefined reference to `sqrtf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:130: undefined reference to `asinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawLineBezierQuad':
    /home/rishi2/dev/raylib/src/shapes.c:195: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:197: undefined reference to `powf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawCircleSector':
    /home/rishi2/dev/raylib/src/shapes.c:251: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:251: undefined reference to `acosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:252: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:275: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:275: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:278: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:278: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:281: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:281: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:295: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:295: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:298: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:298: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawCircleSectorLines':
    /home/rishi2/dev/raylib/src/shapes.c:340: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:340: undefined reference to `acosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:341: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:361: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:361: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:368: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:368: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:369: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:369: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:378: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:378: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawCircleGradient':
    /home/rishi2/dev/raylib/src/shapes.c:395: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:395: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:397: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:397: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawCircleLines':
    /home/rishi2/dev/raylib/src/shapes.c:420: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:420: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:421: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:421: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawEllipse':
    /home/rishi2/dev/raylib/src/shapes.c:436: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:436: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:437: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:437: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawEllipseLines':
    /home/rishi2/dev/raylib/src/shapes.c:451: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:451: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:452: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:452: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawRing':
    /home/rishi2/dev/raylib/src/shapes.c:483: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:483: undefined reference to `acosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:484: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:510: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:510: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:513: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:513: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:516: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:516: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:519: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:519: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawRingLines':
    /home/rishi2/dev/raylib/src/shapes.c:574: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:574: undefined reference to `acosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:575: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:599: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:599: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:600: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:600: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:607: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:607: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:608: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:608: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:610: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:610: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:611: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:611: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:619: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:619: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:620: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:620: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawRectangleRounded':
    /home/rishi2/dev/raylib/src/shapes.c:785: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:785: undefined reference to `acosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:786: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:837: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:837: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:839: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:839: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:841: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:841: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:851: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:851: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:853: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:853: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawRectangleRoundedLines':
    /home/rishi2/dev/raylib/src/shapes.c:1005: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1005: undefined reference to `acosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1006: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1063: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1063: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1065: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1065: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1067: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1067: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1069: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1069: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1202: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1202: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1203: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1203: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawPoly':
    /home/rishi2/dev/raylib/src/shapes.c:1361: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1361: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1364: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1364: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1368: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1368: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `DrawPolyLines':
    /home/rishi2/dev/raylib/src/shapes.c:1406: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1406: undefined reference to `sinf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1408: undefined reference to `cosf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1408: undefined reference to `sinf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `CheckCollisionCircles':
    /home/rishi2/dev/raylib/src/shapes.c:1471: undefined reference to `sqrtf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(shapes.c.o): in function `CheckCollisionLines':
    /home/rishi2/dev/raylib/src/shapes.c:1510: undefined reference to `fminf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1510: undefined reference to `fmaxf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1511: undefined reference to `fminf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1511: undefined reference to `fmaxf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1512: undefined reference to `fminf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1512: undefined reference to `fmaxf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1513: undefined reference to `fminf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/shapes.c:1513: undefined reference to `fmaxf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt__GetGlyphShapeTT':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:1850: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:1851: undefined reference to `sqrt'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt_GetGlyphBitmapBoxSubpixel':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:2745: undefined reference to `floor'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:2746: undefined reference to `floor'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:2747: undefined reference to `ceil'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:2748: undefined reference to `ceil'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt__tesselate_cubic':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:3529: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:3529: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:3529: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:3530: undefined reference to `sqrt'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt_GetBakedQuad':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:3807: undefined reference to `floor'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:3808: undefined reference to `floor'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt_GetPackedQuad':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:4312: undefined reference to `floor'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4313: undefined reference to `floor'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt__ray_intersect_bezier':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:4359: undefined reference to `sqrt'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt__compute_crossings_x':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:4421: undefined reference to `fmod'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt__cuberoot':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:4482: undefined reference to `pow'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4484: undefined reference to `pow'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt__solve_cubic':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:4496: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4504: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4505: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4505: undefined reference to `acos'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4506: undefined reference to `cos'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4507: undefined reference to `cos'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `stbtt_GetGlyphSDF':
    /home/rishi2/dev/raylib/src/external/stb_truetype.h:4562: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4595: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4645: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4663: undefined reference to `sqrt'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_truetype.h:4671: undefined reference to `sqrt'
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o):/home/rishi2/dev/raylib/src/external/stb_truetype.h:4679: more undefined references to `sqrt' follow
    /usr/bin/ld: /usr/local/lib/libraylib.a(text.c.o): in function `GenImageFontAtlas':
    /home/rishi2/dev/raylib/src/text.c:676: undefined reference to `sqrtf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/text.c:677: undefined reference to `logf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/text.c:677: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/text.c:677: undefined reference to `powf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbi__ldr_to_hdr':
    /home/rishi2/dev/raylib/src/external/stb_image.h:1808: undefined reference to `pow'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbi__hdr_to_ldr':
    /home/rishi2/dev/raylib/src/external/stb_image.h:1834: undefined reference to `pow'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbir__srgb_to_linear':
    /home/rishi2/dev/raylib/src/external/stb_image_resize.h:639: undefined reference to `pow'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbir__linear_to_srgb':
    /home/rishi2/dev/raylib/src/external/stb_image_resize.h:647: undefined reference to `pow'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbir__get_filter_pixel_width':
    /home/rishi2/dev/raylib/src/external/stb_image_resize.h:889: undefined reference to `ceil'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_image_resize.h:891: undefined reference to `ceil'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbir__get_coefficient_width':
    /home/rishi2/dev/raylib/src/external/stb_image_resize.h:904: undefined reference to `ceil'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_image_resize.h:906: undefined reference to `ceil'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbir__calculate_sample_range_upsample':
    /home/rishi2/dev/raylib/src/external/stb_image_resize.h:1019: undefined reference to `floor'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_image_resize.h:1020: undefined reference to `floor'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbir__calculate_sample_range_downsample':
    /home/rishi2/dev/raylib/src/external/stb_image_resize.h:1034: undefined reference to `floor'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/external/stb_image_resize.h:1035: undefined reference to `floor'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbir__calculate_coefficients_upsample':
    /home/rishi2/dev/raylib/src/external/stb_image_resize.h:1044: undefined reference to `ceil'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `stbir__calculate_coefficients_downsample':
    /home/rishi2/dev/raylib/src/external/stb_image_resize.h:1092: undefined reference to `ceil'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `GenImageGradientRadial':
    /home/rishi2/dev/raylib/src/textures.c:593: undefined reference to `hypotf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:596: undefined reference to `fmax'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:597: undefined reference to `fmin'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `GenImageCellular':
    /home/rishi2/dev/raylib/src/textures.c:739: undefined reference to `hypot'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:740: undefined reference to `fmin'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `ImageFormat':
    /home/rishi2/dev/raylib/src/textures.c:932: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:933: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:934: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:962: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:963: undefined reference to `round'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o):/home/rishi2/dev/raylib/src/textures.c:964: more undefined references to `round' follow
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `ImageToPOT':
    /home/rishi2/dev/raylib/src/textures.c:1066: undefined reference to `logf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:1066: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:1066: undefined reference to `powf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:1067: undefined reference to `logf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:1067: undefined reference to `ceilf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:1067: undefined reference to `powf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `ImageDrawPixel':
    /home/rishi2/dev/raylib/src/textures.c:2387: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:2388: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:2389: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:2399: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:2400: undefined reference to `round'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o):/home/rishi2/dev/raylib/src/textures.c:2401: more undefined references to `round' follow
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `ColorFromHSV':
    /home/rishi2/dev/raylib/src/textures.c:3540: undefined reference to `fmodf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:3548: undefined reference to `fmodf'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:3556: undefined reference to `fmodf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o): in function `SetPixelColor':
    /home/rishi2/dev/raylib/src/textures.c:3716: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:3717: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:3718: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:3728: undefined reference to `round'
    /usr/bin/ld: /home/rishi2/dev/raylib/src/textures.c:3729: undefined reference to `round'
    /usr/bin/ld: /usr/local/lib/libraylib.a(textures.c.o):/home/rishi2/dev/raylib/src/textures.c:3730: more undefined references to `round' follow
    /usr/bin/ld: /usr/local/lib/libraylib.a(monitor.c.o): in function `glfwSetGamma':
    /home/rishi2/dev/raylib/src/external/glfw/src/monitor.c:486: undefined reference to `powf'
    /usr/bin/ld: /usr/local/lib/libraylib.a(x11_monitor.c.o): in function `calculateRefreshRate':
    /home/rishi2/dev/raylib/src/external/glfw/src/x11_monitor.c:50: undefined reference to `round'
    /usr/bin/ld: /usr/local/lib/libraylib.a(posix_thread.c.o): in function `_glfwPlatformCreateTls':
    /home/rishi2/dev/raylib/src/external/glfw/src/posix_thread.c:44: undefined reference to `pthread_key_create'
    /usr/bin/ld: /usr/local/lib/libraylib.a(posix_thread.c.o): in function `_glfwPlatformDestroyTls':
    /home/rishi2/dev/raylib/src/external/glfw/src/posix_thread.c:58: undefined reference to `pthread_key_delete'
    /usr/bin/ld: /usr/local/lib/libraylib.a(posix_thread.c.o): in function `_glfwPlatformGetTls':
    /home/rishi2/dev/raylib/src/external/glfw/src/posix_thread.c:65: undefined reference to `pthread_getspecific'
    /usr/bin/ld: /usr/local/lib/libraylib.a(posix_thread.c.o): in function `_glfwPlatformSetTls':
    /home/rishi2/dev/raylib/src/external/glfw/src/posix_thread.c:71: undefined reference to `pthread_setspecific'
    collect2: error: ld returned 1 exit status
    Error: execution of an external program failed: 'gcc   -o /home/rishi2/dev/gamedev/nimraylib_now/examples/shapes/shapes_bouncing_ball  /home/rishi2/.cache/nim/shapes_bouncing_ball_d/stdlib_system.nim.c.o /home/rishi2/.cache/nim/shapes_bouncing_ball_d/stdlib_times.nim.c.o /home/rishi2/.cache/nim/shapes_bouncing_ball_d/stdlib_os.nim.c.o /home/rishi2/.cache/nim/shapes_bouncing_ball_d/@m..@s..@ssrc@[email protected] /home/rishi2/.cache/nim/shapes_bouncing_ball_d/@mshapes_bouncing_ball.nim.c.o  -lm -lrt -lraylib   -ldl'
    
    opened by zetashift 9
  • Compiling on Windows

    Compiling on Windows

    Same source works fine on Linux, but when building using Mingw with the latest official Raylib using Windows 8.1, I get "Assertion failed: window != NULL". Using the mingw from the nim website as well as the official latest Nim as well.

    It points to window.c line 516 in the "raylib_mangled/external/glfw/src/window.c"

    I don't know if it has something to do with my src or not as it compiles fine under Linux. Thoughts?

    opened by wwderw 8
  • flag for static linking?

    flag for static linking?

    Would it make sense to have a compile flag for linking with a specified static library instead of a shared library? I tried

    dynlibOverride:raylib
    passL %= "~/git_clones/raylib/src/libraylib.a"
    

    but that didn't seem to help. My aim is to link with raylib compiled for the web using emscripten.

    opened by balenamiaa 8
  • Updated README.md to include a better fix for the windows problem

    Updated README.md to include a better fix for the windows problem

    Changed the Troubleshooting section of README.md to include an easier and more sensible fix for the windows problem. Nim (1.6.6) at least already ships with libwinpthread-1.dll in mingw. The windows problem arises because libwinpthread-1.dll is not on PATH. Using static libraries means that we no longer need libwinpthread-1.dll to be on PATH.

    This is a solution is faster and easier than the previously recommended solution of installing the entire gcc toolchain (which is unnecessary given nim already has the toolchain installed in a default windows install).

    opened by An0nym0us-sh 7
  • setMouseCursor not working

    setMouseCursor not working

    While using nimraylib_now, I discovered that setMouseCursor doesn't work.

    I tried writing the same program in C using raylib from system package manager (which uses glfw from package manager). It works.

    question 
    opened by locriacyber 7
  • Hot code reload

    Hot code reload

    Hello. I was trying the hot code reload feature of Nim following the official docs (https://nim-lang.org/docs/hcr.html). Sincec I got that SDL2 example running I wanted to try that feature with NimraylibNow. I slightly modified the crown.nim example adding a main.nim file that calls some procs on the crown.nim file.

    crown.nim

    import math
    import nimraylib_now
    import std/hotcodereloading
    
    var runGame*: bool = true
    
    const
      nimFg: Color = (0xff, 0xc2, 0x00)          # Use this shortcut with alpha = 255!
      nimBg: Color = (0x17, 0x18, 0x1f)
    ...
    
    proc init* () =
      for i in 0..<crownSides:
        let multiplier = i.float
        # Formulas are for 2D space, good enough for 3D since height is always same
        lowerPoints[i] = (
          x: lowerRadius * cos(centerAngle * multiplier),
          y: lowerRadius * sin(centerAngle * multiplier),
        )
        ...
    
    proc update*() =
      while not windowShouldClose():
        if isKeyPressed(KeyboardKey.F9):      # Trigger the reload
          performCodeReload()
    
        if not pause:
          camera.addr.updateCamera   # Rotate camera
    
     ...
    
    proc destroy*() =
      closeWindow()
    
    

    main.nim

    import crown
    
    proc main() =
      init()
      while runGame:
        update()
      destroy()
    
    main()
    
    

    The code compiles just fine but when I run it I have this error:

    /home/______/.choosenim/toolchains/nim-1.6.10/lib/nimhcr.nim(531) hcrInit
    /home/______/.choosenim/toolchains/nim-1.6.10/lib/nimhcr.nim(490) recursiveDiscovery
    /home/______/.choosenim/toolchains/nim-1.6.10/lib/nimhcr.nim(432) loadDll
    /home/______/.choosenim/toolchains/nim-1.6.10/lib/system/assertions.nim(38) failedAssertImpl
    /home/______/.choosenim/toolchains/nim-1.6.10/lib/system/assertions.nim(28) raiseAssert
    /home/______/.choosenim/toolchains/nim-1.6.10/lib/system/fatal.nim(54) sysFatal
    Error: unhandled exception: /home/______/.choosenim/toolchains/nim-1.6.10/lib/nimhcr.nim(432, 12) `lib != nil`  [AssertionDefect]
    
    

    I don't know how to debug the nimhcr library file to check which library returns nil in loadLib.

    opened by joseasv 1
  • Any raygui samples?

    Any raygui samples?

    I see the paint program has a Save button, which produces a file on save, and supposedly the library here has support for raygui - I'm new to raylib, raygui, and nim, so hoping to find a good reference to do something simple with the 3.

    I found https://github.com/raysan5/raygui/blob/master/examples/custom_file_dialog/custom_file_dialog.c, but when I try guessing at names for the translations based on how raylib did it, I'm hitting some snags (initGuiFileDialog() doesn't exist, at least not when I just import nimraylib_now).

    Any help would be greatly appreciated!

    opened by ahungry 1
  • Black Window with `WINDOW_TRANSPARENT`

    Black Window with `WINDOW_TRANSPARENT`

    Heya,

    I don't get a transparent framebuffer with the window state. Not sure if it's a issue on my end, a issue with raylib itself or with the wrapper.

    echo isWindowState(WINDOW_TRANSPARENT) returns false

    import nimraylib_now
    
    const screenWidth = 1000
    const screenHeight = 1000
    
    setWindowState(WINDOW_TRANSPARENT)
    initWindow screenWidth, screenHeight, "Window"
    
    while not windowShouldClose():
        drawLine 500, 0, 500, getScreenHeight(), fade(LIGHTGRAY, 0.6)
        echo isWindowState(WINDOW_TRANSPARENT)
        clearBackground Blank
        endDrawing()
    closeWindow()
    

    Bildschirmfoto vom 2022-06-04 07-09-07

    opened by qb-0 1
  • Bouncing balls example doesn't runs - isKeyPressed expects a cint instead of KeyboardKey

    Bouncing balls example doesn't runs - isKeyPressed expects a cint instead of KeyboardKey

    The Bouncing Balls example does not compile successsfully and throws an error at isKeyPressed.

        if isKeyPressed(SPACE): pause = not pause
    

    throws

    C:\Users\risharan\Documents\Dev\nim\nimRaylibNow-starter-template\src\game.nim(56, 20) Error: type mismatch: got <KeyboardKey>
    but expected one of:
    proc isKeyPressed(key: cint): bool
      first type mismatch at position: 1
      required type for key: cint
      but expression 'SPACE' is of type: KeyboardKey
    

    The error goes away if I add converters to the imports. In the discord discussion @greenfork said "examples usually load nimraylib_now which re-exports other files including converters. that's strange, maybe I forgot to put it somewhere https://github.com/greenfork/nimraylib_now/blob/master/src/nimraylib_now.nim"

    opened by rishavs 1
  • Destructors

    Destructors

    Currently crashes on exit. If I remove closeWindow(), doesn't crash. Probably because there's a call to unloadTexture after the window was closed and that causes the crash.

    $ cd examples/textures/
    $ nim r --gc:orc textures_to_image.nim
    Hint: used config file '/home/grfork/.choosenim/toolchains/nim-1.6.2/config/nim.cfg' [Conf]
    Hint: used config file '/home/grfork/.choosenim/toolchains/nim-1.6.2/config/config.nims' [Conf]
    ..........................................................................................
    /home/grfork/reps/nimraylib_now/src/nimraylib_now/static_build.nim(4, 1) Hint: duplicate import of 'os'; previous import here: /home/grfork/reps/nimraylib_now/src/nimraylib_now/mangled/raylib.nim(6, 6) [DuplicateModuleImport]
    .........
    CC: stdlib_dollars.nim
    CC: ../../src/nimraylib_now/mangled/raylib.nim
    Hint:  [Link]
    Hint: gc: orc; opt: none (DEBUG BUILD, `-d:release` generates faster code)
    53442 lines; 0.713s; 75.309MiB peakmem; proj: /home/grfork/reps/nimraylib_now/examples/textures/textures_to_image.nim; out: /home/grfork/.cache/nim/textures_to_image_d/textures_to_image_5FC9DD2C66B4B8B494B4BD9E4BF3F178F0C7F7DD [SuccessX]
    Hint: /home/grfork/.cache/nim/textures_to_image_d/textures_to_image_5FC9DD2C66B4B8B494B4BD9E4BF3F178F0C7F7DD  [Exec]
    INFO: Initializing raylib 4.0
    INFO: DISPLAY: Device initialized successfully
    INFO:     > Display size: 1920 x 1080
    INFO:     > Screen size:  800 x 450
    INFO:     > Render size:  800 x 450
    INFO:     > Viewport offsets: 0, 0
    INFO: GLAD: OpenGL extensions loaded successfully
    INFO: GL: Supported extensions count: 229
    INFO: GL: OpenGL device information:
    INFO:     > Vendor:   AMD
    INFO:     > Renderer: AMD RENOIR (DRM 3.44.0, 5.16.5-arch1-1, LLVM 13.0.0)
    INFO:     > Version:  4.6 (Core Profile) Mesa 21.3.5
    INFO:     > GLSL:     4.60
    INFO: GL: DXT compressed textures supported
    INFO: GL: ETC2/EAC compressed textures supported
    INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
    INFO: TEXTURE: [ID 1] Default texture loaded successfully
    INFO: SHADER: [ID 1] Vertex shader compiled successfully
    INFO: SHADER: [ID 2] Fragment shader compiled successfully
    INFO: SHADER: [ID 3] Program shader loaded successfully
    INFO: SHADER: [ID 3] Default shader loaded successfully
    INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
    INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
    INFO: RLGL: Default OpenGL state initialized successfully
    INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
    INFO: FONT: Default font loaded successfully (224 glyphs)
    INFO: FILEIO: [resources/raylib_logo.png] File loaded successfully
    INFO: IMAGE: Data loaded successfully (256x256 | R8G8B8 | 1 mipmaps)
    INFO: TEXTURE: [ID 3] Texture loaded successfully (256x256 | R8G8B8 | 1 mipmaps)
    INFO: TEXTURE: [ID 3] Pixel data retrieved successfully
    INFO: TEXTURE: [ID 4] Texture loaded successfully (256x256 | R8G8B8 | 1 mipmaps)
    INFO: TEXTURE: [ID 3] Unloaded texture data from VRAM (GPU)
    INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
    INFO: SHADER: [ID 3] Default shader unloaded successfully
    INFO: TEXTURE: [ID 1] Default texture unloaded successfully
    INFO: Window closed successfully
    Traceback (most recent call last)
    /home/grfork/reps/nimraylib_now/src/nimraylib_now/mangled/raylib.nim(3103) textures_to_image
    /home/grfork/reps/nimraylib_now/src/nimraylib_now/mangled/raylib.nim(3104) =destroy
    SIGSEGV: Illegal storage access. (Attempt to read from nil?)
    Error: execution of an external program failed: '/home/grfork/.cache/nim/textures_to_image_d/textures_to_image_5FC9DD2C66B4B8B494B4BD9E4BF3F178F0C7F7DD '
    
    opened by greenfork 3
Releases(v0.15.0)
Owner
Dmitry Matveyev
Dmitry Matveyev
Haxe bindings for raylib, a simple and easy-to-use library to learn videogame programming

Haxe bindings for raylib, a simple and easy-to-use library to learn videogame programming, Currently works only for windows but feel free the expand t

FSasquatch 36 Dec 16, 2022
Minimalistic assertion library for raylib.

raylib-assert Minimalistic assertion library for raylib. Example #include "raylib.h" #include "raylib-assert.h" int main(void) { Assert(10 == 10)

Rob Loach 2 Jan 12, 2022
Utilities and common code for use with raylib

Utilities and shared components for use with raylib

Jeffery Myers 86 Dec 1, 2022
Load Aseprite files for animated sprites in raylib.

raylib-aseprite Load Aseprite .aseprite files for animated sprites in raylib. Features Load Aseprite files directly for use in raylib Draw individual

Rob Loach 30 Dec 20, 2022
Integrate PhysFS with raylib, allowing to load images, audio and fonts from data archives.

raylib-physfs Integrate the virtual file system PhysicsFS with raylib, allowing to load images, audio, and fonts from data archives. Features Load the

Rob Loach 21 Dec 3, 2022
RayLib extern bindings for Haxe

raylib-haxe Haxe bindings for RayLib usage haxelib git raylib-haxe https://github.com/haxeui/raylib-haxe package; import RayLib.*; import RayLib.Cam

HaxeUI 24 Dec 3, 2022
SWIG bindings for raylib (to Lua, and hopefully other languages)

swigraylib SWIG binding for raylib This repo generates raylib bindings to other languages (eg. Lua), by providing a raylib.i SWIG interface file. SWIG

null 6 Oct 28, 2021
A pong clone written in C++ with Raylib

How To Play Objective: first player to reach 10 points is the winner! PLAYER 1: W: up S: down PLAYER 2: ARROW UP or I: up ARROW DOWN or S: down Requir

Victor Sarkisov 1 Nov 8, 2021
autogen bindings to Raylib 4.0 and convenience wrappers on top. Requires use of `unsafe`

Raylib-CsLo Raylib-CsLo LowLevel autogen bindings to Raylib 4.0 and convenience wrappers on top. Requires use of unsafe A focus on performance. No run

NotNot 69 Dec 18, 2022
Pong clone made in C++ with raylib

Raypong Pong clone made in C++ with raylib. Dependencies ...C++ and raylib lol Building To build, use these commands: mkdir build # Create a build dir

Mars 0 Feb 4, 2022
raylib Nuget package

raylib Nuget package This is a Nuget package for the popular raylib video game programming library. Resources used to create this package are as follo

Samuel Gomes 6 Dec 5, 2022
My collection of raylib code examples - For learning the C language with 2D and 3D games.

Raylib-Examples My collection of raylib examples. ( https://www.raylib.com/index.html ) For Raylib Version of 4 april 2020 ( Notepad++ windows install

Rudy Boudewijn van Etten 49 Dec 28, 2022
A top-down shooter made for the raylib 5K gamejam.

ANTISPELL Description A top-down shooter where you have to use your enemies' attacks to spell your spells! Features Absorb letters getting close to en

Francisco Javier Andrés Casas Barrientos 3 Apr 9, 2022
curl4cpp - single header cURL wrapper for C++ around libcURL.

curl4cpp - single header cURL wrapper for C++ around libcURL.

Ferhat Geçdoğan 15 Oct 13, 2022
Header-only C++20 wrapper for MPI 4.0.

MPI Modern C++20 message passing interface wrapper. Examples Initialization: mpi::environment environment; const auto& communicator = mpi::world_c

Ali Can Demiralp 29 Apr 8, 2022
A wrapper around std::variant with some helper functions

A wrapper around std::variant with some helper functions

Eyal Amir 1 Oct 30, 2021
Isocline is a pure C library that can be used as an alternative to the GNU readline library

Isocline: a portable readline alternative. Isocline is a pure C library that can be used as an alternative to the GNU readline library (latest release

Daan 136 Dec 30, 2022
A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename.

whereami A linux library to get the file path of the currently running shared library. Emulates use of Win32 GetModuleHandleEx/GetModuleFilename. usag

Blackle Morisanchetto 3 Sep 24, 2022
Command-line arguments parsing library.

argparse argparse - A command line arguments parsing library in C (compatible with C++). Description This module is inspired by parse-options.c (git)

Yecheng Fu 533 Dec 26, 2022