-
Notifications
You must be signed in to change notification settings - Fork 16
Broken imports when using physac in module #12
Comments
That is a lot of input from your side, thank you! |
Could you please try this: import nimraylib_now/raylib
import nimraylib_now/physac
proc test*()=
discard RayWhite
initPhysics()
let body = createPhysicsBodyRectangle((0.0, 0.0), 32.0, 32.0, 10.0) Here we add I'm not sure what the correct fix should be to this situation. It doesn't work if I add it directly to I see that the only reason you add here |
You're right, this fixes the issue.
In that minimal example, yes, but in my real project I also use some other methods from raylib.
This might be a good idea either way, but will it really help with this issue? As physac needs raylib for the
So it's not just about tuple conversion. I'm kinda surprised, that Nim gets rid of the import although |
This looks like the issue is with the order of imports: // /home/grfork/.cache/nim/main_d/@[email protected]
/* Generated by Nim Compiler v1.4.4 */
/* (c) 2020 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: Linux, amd64, gcc */
/* Command for C compiler:
gcc -c -w -fmax-errors=3 -DPHYSAC_IMPLEMENTATION -DPHYSAC_NO_THREADS -I/home/grfork/.choosenim/toolchains/nim-1.4.4/lib -I/tmp/nimraylib_now_issue -o /home/grfork/.cache/nim/main_d/@[email protected] /home/grfork/.cache/nim/main_d/@[email protected] */
#define NIM_INTBITS 64
/* section: NIM_merge_HEADERS */
#include "nimbase.h"
#include "/home/grfork/reps/nimraylib_now/src/nimraylib_now/physac.h"
#include "/home/grfork/reps/nimraylib_now/src/nimraylib_now/raylib.h"
... Raylib must be imported before physac. Let's see how's the resolution of #5 goes, it might solve this problem too. If not, we will try to somehow affect the order of importing. |
This problem exists on Mac too. |
One of the solutions to this problem is to create a single header file out of all other headers. This way we control the order of imports. |
Sorry if it is an issue on my side, I'm still quite new to Nim and raylib.
When importing raylib as well as physac in my main class, everything is working fine and as expected.
When I tried to move physac into an own module, though, it seems that imports are broken.
My setup looks like:
where
main.nim
imports:and
module.nim
imports:When I then try to use physac like so in the module, i run into the issue above:
I created a git repository containing a minimal example, you can find it here
The text was updated successfully, but these errors were encountered: