Problems embedding Julia in C++

Hello!

I am properly making a small mistake somewhere, but basically I am using CMake to try to include Julia capabilities in my cpp project. What I have in my CMakeLists.txt for that specific part of the project is:

include_directories("/opt/julia-1.4.0/include/julia/")

Which makes it so that I am able to correctly find “julia.h”. The problem arises though when I want to use any functionality, for example, “jl_init()”:

And I am unsure on how to go from here. I have tried reading the wiki, but there is something I probably have misunderstood. Any suggestions on how to move forward?

Kind regards

I don’t know CMake, however to me that looks like you are not linking with libjulia.so. Did you tell CMake to link with it?

1 Like

You are completely right! Spared me a few hours of extra headache :slight_smile:

Do you have any suggestions for which version to use, I can find three;

image

EDIT: there is only two, the last was a folder. EDIT2: No there is three I was wrong

Also I guess, that since I am using a .so now, if I ever send my application to someone else, they would also need the .so object? And then it has to comply with Julia’s license?

Kind regards

I suspect they are all symbolic links to the same file (libjulia.so)…Linking with libjulia.so.1.4 ensures that it only runs with Julia 1.4…so you would have to change the linkage if you wanted to upgrade to 1.5, etc. Linking to libjulia.so would link to whatever version of julia they have…which may not be what you want.

Not sure about the license thing, I suspect the license is pretty liberal…I mean the code is licensed under the MIT license.

I see, seems like a reasonable assumption, will stick with the common one.

And true, if if gets that far I will have to look into licensing a bit more. But once again, thank you very much

Kind regards

You can always make a requirement of your program that they install Julia…It avoid the license issue when they install it from the site. :slight_smile:

1 Like