Неопределенная ссылка на «dlsym»C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Неопределенная ссылка на «dlsym»

Сообщение Anonymous »


I have seen a lot of similar posts, but tried every trick in the book and am still struggling. Everything was working fine, but after installing/removing wireshark with some components/disselectors it all got messed up. I don't remember exactly which libraries/packages got uninstalled, but probably a lot more than I noticed.

If I create a simple main.cpp file like this one:

#include int main() { SAConnection con; return 0; } and try

g++ main.cpp -lsqlapi -ldl

it gives me the following error messages:

/usr/local/lib/libsqlapi.so: undefined reference to `dlsym' /usr/local/lib/libsqlapi.so: undefined reference to `dlerror' /usr/local/lib/libsqlapi.so: undefined reference to `dlopen' /usr/local/lib/libsqlapi.so: undefined reference to `dlclose' collect2: error: ld returned 1 exit status I have tried to put -ldl before -lsqlapi as some have suggested that the order is important. If I use gcc instead of g++ the error is:

/usr/bin/ld: /tmp/ccwBI4tj.o: undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3' /usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status I am able to compile and run the file if SAConnection is removed.

I don't think it has anything to do with SQLAPI, because I experience similar problems with libboost. I don't have a small code example, but when I compile a project that was successfully compiled last week, I get the error:

/usr/bin/ld: debug/components/helloworld/HelloWorld.o: undefined reference to symbol '_ZN5boost6system15system_categoryEv' /usr/lib/x86_64-linux-gnu/libboost_system.so.1.53.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status This project is using a Makefile that has been unchanged, so it has to be something on my system that is not correct. I have tried to reinstall build-essential.

Using Ubuntu 64 bit 13.10 with g++ version 4.8.1.


Источник: https://stackoverflow.com/questions/203 ... e-to-dlsym
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»