Unable to Compile with Static Libraries Raylib 4.0.0
Closed this issue · 2 comments
I am trying to statically compile a simple starter application with Raylib 4.0.0, but I am getting the following error:
Error: function bindbc.raylib.bindstatic.TextSplit
without this
cannot be const
The full error is shown below:
PS A:\Programming\GitHub-andrewlalis\NewtonsForest> dub build
Performing "debug" build using C:\D\dmd2\windows\bin\dmd.exe for x86_64.
bindbc-loader 1.0.1: target for configuration "noBC" is up to date.
bindbc-raylib3 0.5.0: building configuration "dynamic"...
C:\Users\andrew\AppData\Local\dub\packages\bindbc-raylib3-0.5.0\bindbc-raylib3\src\bindbc\raylib\bindstatic.d(1395,17): Error: function `bindbc.raylib.bindstatic.TextSplit` without `this` cannot be `const`
C:\D\dmd2\windows\bin\dmd.exe failed with exit code 1.
I notice that it says building configuration "dynamic"
, which is probably the cause of the issue, but I'm not sure how to change that configuration setting, after having consulted the wiki pages and readme.
Here is my dub.json
:
{
"authors": [
"Andrew Lalis"
],
"copyright": "Copyright © 2021, Andrew Lalis",
"dependencies": {
"bindbc-raylib3": "~>0.5.0"
},
"versions": ["RAYLIB_400", "BindRaylib_Static"],
"libs": ["libraylib"],
"description": "A minimal D application.",
"license": "proprietary",
"name": "newtonsforest"
}
And here's my basic program:
import bindbc.raylib;
void main() {
InitWindow(800, 600, "Newton's Forest");
SetTargetFPS(60);
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(GREEN);
DrawText("Hello world!", 200, 200, 32, RED);
EndDrawing();
}
CloseWindow();
}
I've included the required libraylib.a
static library files in the root directory of my project as well.
Thank you for you segnalation, it's fixed on rel. 0.5.1
Why don't you use dynanic binding? in my opinion it's simpler...
Thank you for you segnalation, it's fixed on rel. 0.5.1 Why don't you use dynanic binding? in my opinion it's simpler...
Yes, it's simpler and I use the dynamic library for development, but I was doing a test-run for building a final release executable which would not depend on any dynamic libraries, just as a sanity check so I'm not completely lost when it comes time to do it for real.