Hello thanks a lot for your answer.
You assumed correctly I do use version 0.4.
If I got right your proposal about the linking error is to use
the command jl_inti(JULIA_INIT_DIR) as shown in this
<http://julia.readthedocs.org/en/latest/manual/embedding/#example>
example and use a makefile where I just copy paste the
commands shown in the example, so the makefile looks like that:
JL_SHARE = $(shell julia -e
'print(joinpath(JULIA_HOME,Base.DATAROOTDIR,"julia"))')
CFLAGS += $(shell $(JL_SHARE)/julia-config.jl --cflags)
CXXFLAGS += $(shell $(JL_SHARE)/julia-config.jl --cflags)
LDFLAGS += $(shell $(JL_SHARE)/julia-config.jl --ldflags)
LDLIBS += $(shell $(JL_SHARE)/julia-config.jl --ldlibs)
all: main
and my source code looks like that:
#include <julia.h>
int main(int argc, char *argv[])
{
/* required: setup the julia context */
jl_init(JULIA_INIT_DIR);
/* run julia commands */
jl_eval_string("print(sqrt(2.0))");
/* strongly recommended: notify julia that the
program is about to terminate. this allows
julia time to cleanup pending write requests
and run all finalizers
*/
jl_atexit_hook();
return 0;
}
Yet again when I try to compile I receive the following errors:
make: /home/kostav/julia/usr/bin/../share/julia/julia-config.jl: Command
not found
make: /home/kostav/julia/usr/bin/../share/julia/julia-config.jl: Command
not found
make: /home/kostav/julia/usr/bin/../share/julia/julia-config.jl: Command
not found
cc main.c -o main
main.c:1:19: fatal error: julia.h: No such file or directory
#include <julia.h>
^
compilation terminated.
<builtin>: recipe for target 'main' failed
make: *** [main] Error 1
Note that I have really no experience with makefiles so I can not really
handle them
properly, but I assumed that I should be working if I did all it was saying
in the example.
Yet again I receive the above errors.
On Monday, July 13, 2015 at 9:30:33 AM UTC+2, Jeff Waller wrote:
It's not clear to me which version you are using? Depending on the
> version, It is referred
> to in the URL you linked...
>
> I'll just cut to the chase use 0.4 and julia_config.jl as described in the
> doc, create a
> Makefile just cut-and-paste the example, and augment with your source.
> All but
> one of your errors is a result of the wrong compile/link flags.
>
> The last error is that main() is either not being compiled or linked,
> that's just straight-up
> C programming, and has nothing to do with Julia.
>
> As far as eclipse goes, I'm confident it's possible, I can't imagine
> eclipse not supporting
> compilation using Makefiles, but even if it doesn't you can still automate
> things, but just
> get something working first and you can embellish later.
>
> TL;DR
>
> 0.4, julia_config, cut-paste Makefile, add your source, done
>