digitalmars.D.learn - Raylib linking error
- Ki (9/9) Jul 29 2021 I tried to compile a new project with Raylib yesterday:
- Ki (4/13) Jul 29 2021 It seems I need to link Cocoa and IOKit frameworks, but how do I
- Mike Parker (16/32) Jul 29 2021 My answer on reddit:
I tried to compile a new project with Raylib yesterday: dub init => ... => dub add raylib-d. My dub.json file does contain the "libs": ["raylib"] section, so the compiler links against raylib library. Then I built the project and got a linker error referencing a whole bunch of opengl, glfw functions. Does anyone know what is the problem here? I am a little puzzled on what to try next, but to build raylib myself from source (I use brew to manage packages).
Jul 29 2021
On Thursday, 29 July 2021 at 07:59:38 UTC, Ki wrote:I tried to compile a new project with Raylib yesterday: dub init => ... => dub add raylib-d. My dub.json file does contain the "libs": ["raylib"] section, so the compiler links against raylib library. Then I built the project and got a linker error referencing a whole bunch of opengl, glfw functions. Does anyone know what is the problem here? I am a little puzzled on what to try next, but to build raylib myself from source (I use brew to manage packages).It seems I need to link Cocoa and IOKit frameworks, but how do I tell this to DUB? I'm browsing the dub documentation and cannot find anything framework-related.
Jul 29 2021
On Thursday, 29 July 2021 at 10:07:15 UTC, Ki wrote:On Thursday, 29 July 2021 at 07:59:38 UTC, Ki wrote:My answer on reddit: The -framework flag on Mac is a linker flag. Linker flags are handled in DUB via the lflags entry. Assuming XLinker is being used, it should probably look something like this: ``` "flags": ["-framework", "CoreVideo", "-framework", "IOKit"] ``` In other words, a string for the -framework flag and the framework name for each of the frameworks you need. Because according to the forum thread below, passing them to DMD directly requires the -L switch (meaning, the library flag switch) for both -framework and the name. (Ignore the bit about the link pragma in that thread... that's specific to an old build tool that's no longer around). https://forum.dlang.org/post/gp3uk2$gnd$1 digitalmars.comI tried to compile a new project with Raylib yesterday: dub init => ... => dub add raylib-d. My dub.json file does contain the "libs": ["raylib"] section, so the compiler links against raylib library. Then I built the project and got a linker error referencing a whole bunch of opengl, glfw functions. Does anyone know what is the problem here? I am a little puzzled on what to try next, but to build raylib myself from source (I use brew to manage packages).It seems I need to link Cocoa and IOKit frameworks, but how do I tell this to DUB? I'm browsing the dub documentation and cannot find anything framework-related.
Jul 29 2021