I need to call a C++ library from Julia. I was thinking to try either Cxx package or CxxWrap package. For Cxx, when I was trying to install this Cxx package to my Julia, get the following error message:
(v1.1) pkg> add Cxx
Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Atom [c52e3926]:
Atom [c52e3926] log:
├─possible versions are: [0.8.0-0.8.8, 0.9.0-0.9.1, 0.10.0-0.10.2, 0.11.0-0.11.3] or uninstalled
└─restricted to versions 0.7.14 by an explicit requirement — no versions left
If you only need a few functions, I’ve found declaring the functions you wish to call extern "C" (creating wrappers if necessary), compiling into a shared library, and then ccall-ing them to be the simplest approach.
Thank you for your quick reply. I’m new to Cxx package. I tried to install Cxx in a clean environment, and it did not work either, sigh.
(v1.0) pkg> activate ~/Desktop/Cxx
[ Info: activating new environment at ~/~/Desktop/Cxx.
(Cxx) pkg> activate
(v1.0) pkg> activate /Desktop/Cxx
[ Info: activating new environment at /Desktop/Cxx.
(Cxx) pkg> add Cxx
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Cxx [a0b5b9ef]:
Cxx [a0b5b9ef] log:
├─possible versions are: 0.3.0-0.3.2 or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions 0.3.0-0.3.2
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left
I also tried to remove Juno package and install Cxx again, it did not work either.
julia> Pkg.status()
Status `~/.julia/environments/v1.0/Project.toml`
[c52e3926] Atom v0.9.1
[336ed68f] CSV v0.5.11
[324d7699] CategoricalArrays v0.5.5
[34da2185] Compat v2.1.0
[8f4d0f93] Conda v1.3.0
[1f15a43c] CxxWrap v0.8.2
[a93c6f00] DataFrames v0.19.3
[864edb3b] DataStructures v0.17.0
[31a5f54b] Debugger v0.6.2
[31c24e10] Distributions v0.21.1
[cd3eb016] HTTP v0.8.5
[682c06a0] JSON v0.21.0
[fc18253b] LazyJSON v0.1.1
[522f3ed2] LibExpat v0.5.0
[093fc24a] LightGraphs v1.3.0
[9c8b4983] LightXML v0.8.0
[86cd37e6] OpenStreetMapX v0.1.11 [`~/.julia/dev/OpenStreetMapX`]
[d3d4fdd0] OpenStreetMapXPlot v0.1.2 #master (https://github.com/pszufe/OpenStreetMapXPlot.jl)
[91a5bcdd] Plots v0.26.2
[438e738f] PyCall v1.91.2
[ee283ea6] Rebugger v0.3.2
[189a3867] Reexport v0.2.0
[295af30f] Revise v2.2.0
[90137ffa] StaticArrays v0.11.0
[f3b207a7] StatsPlots v0.10.2
[9a3f8284] Random
(v1.0) pkg> add Cxx
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Cxx [a0b5b9ef]:
Cxx [a0b5b9ef] log:
├─possible versions are: 0.3.0-0.3.2 or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions 0.3.0-0.3.2
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left