嵌入julia编译不通过, 求助

#include <julia.h>
JULIA_DEFINE_FAST_TLS() // only define this once, in an executable (not in a shared library) if you want fast code

int main(int argc, char argv[])
{
/
required: setup the Julia context */
jl_init();

/* 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(0);
return 0;

}

编译结果
gcc -o test -fPIC -I/usr/include/julia -L/usr/lib test.c -ljulia /usr/lib/libstdc++.so.6
/usr/bin/ld: /tmp/cci1znro.o: in function main': test.c:(.text+0x10): undefined reference to jl_init’
collect2: 错误:ld 返回 1

Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Celeron(R) CPU N3150 @ 1.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, silvermont)

我用如下命令设置好了 JULIA_DIR: julia 的安装目录,$JULIA_DIR/bin/julia 就是 julia 的 repl;
设置了 JULIA_BINDIR=$JULIA_DIR/bin

export JULIA_DIR=~/julia-1.1.0  # Julia's install dir
export JULIA_BINDIR=$JULIA_DIR/bin

echo $JULIA_DIR 
echo $JULIA_BINDIR 

文档中的例子与编译条件 报同样的错误。

julia-config.jl 脚本编译就没有任何问题

编译 test.c (就是 你的/文档中的第一个 例子)

$JULIA_DIR/share/julia/julia-config.jl --cflags --ldflags --ldlibs | xargs gcc -o test test.c

输出

~$ ./test 
1.4142135623730951

确实通过了, 谢谢