Undefined Reference to 'dlopen'

Asked

Viewed 108 times

1

I’m trying to upload a file .so, but this title error is showing up. Can anyone help me?

    #include <iostream>
    #include <dlfcn.h>
    #include <stdio.h>

    using namespace std;

    int main()
    {
      void *abrir;
      abrir = dlopen("EZClient.so", RTLD_NOW);

    if(!abrir)
    {
      printf("%s\n", dlerror());
      return -1;
    }
    return 0;
    }

1 answer

2


The implementations of the functions dlopen and dlerror are in a library called libdl.so.

So in order for you to Compile this program, using g++, you have to run the following command line

g++ -o programa programa.cpp -ldl

that is, add the library using the option -ldl

Browser other questions tagged

You are not signed in. Login or sign up in order to post.