Skip to content

Issue linking test to static library #10054

Answered by eli-schwartz
avetiso asked this question in Q&A
Discussion options

You must be logged in to vote

Since you mention inc = include_directories('base64') in the src/ directory, I assume your layout looks like this:

.
├── meson.build
├── src
│   ├── base64
│   │   └── base64.h   # <<<
│   ├── _internal
│   │   └── base64.cpp
│   └── meson.build
└── test
    ├── main.cpp
    └── meson.build

And base64.cpp is doing #include "base64.h" and the static library compiles okay.

But the test program includes the public interface, which is <base64/base64.h>, which means the include directory you need to add is different from the internal one.

I think you need public_inc = include_directories('.') as well.

Consider adding a declare_dependency() for your library. libbase64_dep would link to libbase…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@avetiso
Comment options

@eli-schwartz
Comment options

Answer selected by avetiso
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants