raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming
http://www.raylib.com
zlib License
22.21k stars 2.24k forks source link

[example] `models_point_rendering.c` example fails to build with Clang 18.1.3 on Ubuntu #4283

Closed zmertens closed 1 month ago

zmertens commented 1 month ago

Description

Build error using CMake 3.28.3 in terminal: ..."models_point_rendering.c:49:17: error: call to undeclared function 'GenPoints"

Using cmake to build: cmake -S . -B build -G"Ninja" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang , and was able to reproduce with Unix Makefiles too.

System Info inxi -F

System:
  Host: NA Kernel: 6.8.0-41-generic arch: x86_64 bits: 64
  Desktop: Unity v: N/A Distro: Ubuntu 24.04 LTS (Noble Numbat)
Machine:
  Type: Laptop System: HP product: HP ProBook 440 G3 v: N/A
    serial: <superuser required>
  Mobo: HP model: 8100 v: KBC Version 40.60 serial: <superuser required>
    UEFI: HP v: N78 Ver. 01.12 date: 06/14/2016
Battery:
  ID-1: BAT0 charge: 17.7 Wh (100.0%) condition: 17.7/17.7 Wh (100.0%)
CPU:
  Info: dual core model: Intel Core i7-6500U bits: 64 type: MT MCP cache:
    L2: 512 KiB
  Speed (MHz): avg: 500 min/max: 400/3100 cores: 1: 500 2: 500 3: 500 4: 500
Graphics:
  Device-1: Intel Skylake GT2 [HD Graphics 520] driver: i915 v: kernel
  Device-2: Chicony HP HD Camera driver: uvcvideo type: USB
  Display: wayland server: X.Org v: 23.2.6 with: Xwayland v: 23.2.6
    compositors: 1: gnome-shell 2: sommelier driver: dri: iris gpu: i915
    resolution: 1920x1080~60Hz
  API: EGL v: 1.5 drivers: iris,swrast
    platforms: wayland,x11,surfaceless,device
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 24.0.9-0ubuntu0.1
    renderer: Mesa Intel HD Graphics 520 (SKL GT2)

Fresh clone of master @ bc0bd98763bba496836c5cfc1418949256bc6f4d

Fix

Add forward-declaration of the function:

... Header and Comments

#include "raylib.h"
#include <stdlib.h>         // Required for: rand()
#include <math.h>           // Required for: cos(), sin()

#define MAX_POINTS 10000000 // 10 million
#define MIN_POINTS 1000     // 1 thousand

static float RandFloat();

// Forward-declare function
Mesh GenPoints(int numPoints);

... Rest of example

Screenshot

image

raysan5 commented 1 month ago

@zmertens this issue should be already fixed.