lundi 24 avril 2023

Factory method in dynamic library with explicitly instantiated templated classes

This is a follow up question to the one placed in Factory method does not work when used in dynamic library with templated classes.

To keep to post shorter I have placed the code in: https://godbolt.org/z/ab8Ys8dKe

I am compiling the code with g++ -g -fPIC Base.cpp Derived.cpp factory.cpp -shared -o test.so to create the dynamic library and then linkin it with: g++ -g -o main main.cpp -I . -L. test.so but I am getting an error: /main: error while loading shared libraries: test.so: cannot open shared object file: No such file or directory

How can I link the library correctly?

Aucun commentaire:

Enregistrer un commentaire