Sooooo confusing using Julia
I don’t understand why the following simple codes doesn’t work at all with error message AbstractGlidingVehicle not defined
.
Even my other custom package is similarly written, but that works.
Note: I’m running code as include("test/runtests.jl")
.
+) Please let me know how to develop a custom packages and use them. It’s really confusing, especially paths of files, use of other registered packages, and precompiling with PackageCompiler.jl.
Do I have to install the same registered packages (e.g., LinearAlgebra.jl
) in all my custom environments? If you can, please share the easiest and clearest way to make and use custom packages…
EDIT: suddenly this code works, and it doesn’t work again with different error…
Note: I’m using rsync and running codes on server.
EDIT2: I may found what raises error (but I don’t know why). Replacing using Revise; includet("glidingvehicle.jl"
in src/Environment.jl
by include("glidingvehicle.jl")
works well.
Then, should I re-run julia everytime I change my custom package?
EDIT3: After changing includet("glidingvehicle.jl")
to includet("src/glidingvehicle.jl") also works. Probably the location where I run the code is crucial in Julia, and this makes really confused. Is there any way to fix it? In my case when using Python, I used prefix
PYTHONPATH=“.”`.
test/runtests/jl
using Environment
using Test
function test_all()
gv = GlidingVehicle.AbstractGlidingVehicle()
end
test_all()
src/Environment.jl
module Environment
using Revise
includet("glidingvehicle.jl")
export GlidingVehicle
end
src/glidingvehicle.jl
module GlidingVehicle
using Parameters
export AbstractGlidingVehicle
@with_kw mutable struct AbstractGlidingVehicle
i::Int64 = 1
end
end