shared library error about “undefined symbol” when using `dlopen`
问题 First thing first, here's my minimum reproducible program: CMakeLists.txt: cmake_minimum_required(VERSION 3.17) project(untitled4) set(CMAKE_CXX_STANDARD 17) add_library(lib1 SHARED lib1.cpp) add_executable(untitled4 main.cpp) target_link_libraries(untitled4 PRIVATE dl) main.cpp: #include "iostream" #include <dlfcn.h> int Test() { return 123456; } int main() { auto* handler = dlopen("/home/liu/source/untitled4/cmake-build-debug/liblib1.so", RTLD_LAZY|RTLD_GLOBAL); if (!handler) { std::cerr <<