mirror of
https://github.com/google/brotli.git
synced 2026-07-08 17:56:58 +00:00
Link as static library to side project error. #371
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @slesarev-hub on GitHub (Feb 5, 2021).
I've build library with CMake as said in readme.
Now I'm trying to link Brotli to another C++ project. The problem here simplified as much as possible:
example.cpp (file stored in Brotli project root)
build from terminal
g++ -o example example.cpp -Lbuild -lbrotlicommon-static -lbrotlidec-static -lbrotlienc-static -Ic/includeerror log
@deymo commented on GitHub (Feb 5, 2021):
Hi,
I think this is due to the order of the
-lparameters being wrong (but I didn't test this specific example myself). You need to pass-lbrotlienc-staticbefore-lbrotlicommon-staticbecauseencdepends oncommon, and the same fordec. I know it feels backwards but that's how the linker works, here's a nice article about why.Could you try that?
@slesarev-hub commented on GitHub (Feb 5, 2021):
It helps, thank you!