Newbie for calling julia c files con c and c++

Hello!
I want to use julia as a scripting language on a game, im giving my first steps on trying scripting languages on c++.
Can anyone help me to compile it calling julia.h? Im on windows 7 Dev-c++ 5.11, include directories C:\Julia-1.0.0\include\julia, added ",library C:\Julia-1.0.0\lib added, “library or object” linking to Julia-1.0.0/lib/libjulia.dll.a but it gives the error main.cpp:(.text+0x17): undefined reference to `__imp_jl_init’ [Error] ld returned 1 exit status so its a link problem i guess.
The code i wanna compile is:

 #include <julia.h>
int main(int argc, char *argv[])
{
    jl_init();
    (void)jl_eval_string("println(sqrt(2.0))");
    jl_atexit_hook(0);
    return 0;
}
1 Like

I have the same problem in C, and a similar one with c#. Did you solve it? Thanks

I just moved to lua for the task i was doing, simpler and fast. Sorry bro.

Just ran into the same issue after upgrading to Julia 1.1 from 0.6.4 on Windows 10 (mingw toolchain). Investigating now… any tips on what changed in 1.0+ welcome!

solved - need to #define JULIA_ENABLE_THREADING before #include <julia.h> on Windows. Not very intuitive… identified in https://github.com/JuliaLang/julia/issues/28969. The related documentation PR seems to be merged, although it only mentions Visual Studio which might throw some people off.

Now running into another issue:

- any help greatly appreciated!

solved: check that Julia’s provided C++ stdlib is loaded before any other ones get the chance to load :slight_smile: