user9485581
user9485581

Reputation: 1

Use dynamic library in dynamic library

I am always using QDesignerCustomWidgetInteface. I want to use two kinds of CustomWidget in another CustomWidget to combine two of them so that I need not to write some codes again.

So I write codes as below in project file:

LIBS +=-L./debug -lxzquxianplugin
LIBS +=-L./debug -lxzyctextplugin

When I finished the code I debug the codes in creator and started debugging designer. Designer ran well and recognized my new CustomWidget. But when I entered bin/gcc/debug folder and ran executable app Designer that debug mode produced directly without codes and Qt creator, Designer showed that could not find shared library: libxzquxianplugin.so.

I tried to use codes as below:

Debug {
    LIBS +=absolute path way of xzquxianplugin
    LIBS +=absolute path way of xzyctextplugin
}

But it still failed to find dynamic library when I ran Designer in debug folders. I cannot understand why it happened.

Upvotes: 0

Views: 43

Answers (1)

Mohammad Kanan
Mohammad Kanan

Reputation: 4582

the libs -L switch is used when you want to add a directory to linker search path, you used:

LIBS +=-L. /debug -lxzquxianplugin

Which actually breaks your path because of the space after -L.

So you should have

LIBS +=-L./debug -lxzquxianplugin

given that your lib exists under debug folder.

Upvotes: 1

Related Questions