I wasn’t able to find a more suitable forum/topic to discuss my problem. Please re-direct if this isn’t the right place to do so.
I am trying to use a C++ framework for a course (do demonstrations & display code stubs & print charts statically & dynamically), and chose Xeus-Cling as it integrates well into the Jupyter environment. I am trying to understand how dynamic libraries are loaded and used within the environment, but I am getting errors that I don’t know how to resolve. I started with this code stub that implements a trivial square root function.
double calcSqrt(double d)
double d = 100;
I was able to compile the ‘calc.c’ as a dynamic library, and load it with main to get the result. The commands below did not receive any error.
gcc -c calc.c
gcc -c main.c
gcc -shared -fPIC -o libcalc.so calc.o
gcc main.o ./libcalc.so -lm
However, when I ported it over to the Jupyter environment, I got an error.
#pragma cling add_library_path("<path_of_project>")
#pragma cling load(“libcalc”)
This is the error I got. I can’t figure out why since an objdump indicates that function is in the library (.so) file.
"IncrementalExecutor::executeFunction: symbol ‘_Z8calcSqrtd’ unresolved while linking [cling interface function]! You are probably missing the definition of calcSqrt(double) Maybe you need to load the corresponding shared library?
Any help will be greatly appreciated. Thanks in advance!