Solved I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.
-
I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.
I use a simple c code to reference this library without any problem.
Thanks!:-1: error: library not found for -ltestlib
macx { LIBS += -L$$PWD/libs/macos/ -ltestlib INCLUDEPATH += $$PWD/libs/macos/ }
in $$PWD/libs/macos:
-rw-r--r-- 1 sen admin 2.1M 10 14 16:14 testlib.dylib -rw-r--r-- 1 sen admin 1.6K 10 14 17:53 testlib.h
-
@jsulm It is indeed a lib naming problem. After changing to libtest.dylib, it should be like this:
LIBS += -L$$PWD/libs/macos/ -ltest. -
@senmx said in I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.:
LIBS += -L$$PWD/libs/macos/ -ltestlib
The error message says that linker can't find the lib. Check the path you pass to -L (you can check compile log to see what path exactly is passed).
I'm not sure how this is handled on MacOS, but on Linux linker expects this naming convention for libs: libLIBNAME.so. That means: the file name should start with "lib". -
@jsulm
if i look at: qt-and-zip-files
it should be:
LIBS += -L$$PWD/libs/macos/ -ltestthe .pro i use for asoundlib on linux:
linux { INCLUDEPATH += $$MidiClient/Linux HEADERS += $$MidiClient/Linux/ALSA/MidiClientAPI.h SOURCES += $$MidiClient/Linux/ALSA/MidiClientAPI.cpp LIBS += -lasound } and in the .h
#ifndef LINUXMIDIAPI_H
#define LINUXMIDIAPI_H#include "MidiAPI.h"
#include <alsa/asoundlib.h> -
@jsulm It is indeed a lib naming problem. After changing to libtest.dylib, it should be like this:
LIBS += -L$$PWD/libs/macos/ -ltest.