ut
ut copied to clipboard
Linker error when using `should` and compiling as a module
Expected Behavior
Compilation without any error.
Actual Behavior
/usr/bin/ld: /tmp/main-566205.o: in function `main::$_0::operator()() const':
main.cpp:(.text+0x198): undefined reference to `boost::ext::ut::v1_1_8::should'
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
Steps to Reproduce the Problem
- Paste the module to a new file called
ut.cpp
- Compile the module into
boost.ut.pcm
:
clang++ -std=c++20 -stdlib=libc++ -D __cpp_modules -c -fmodules -Xclang -emit-module-interface -o boost.ut.pcm ut.cpp
- Paste the following into a new file called
main.cpp
:
import boost.ut; // It works when I do #include "ut.cpp" tho
int main() {
using namespace boost::ut;
"test"_test = [] {
should("work") = [] {};
};
}
- Build
main.cpp
:
clang++ -std=c++20 -stdlib=libc++ -fmodules -fprebuilt-module-path=. main.cpp
Specifications
- Version: Latest, copied directly from Github
- Platform: Arch Linux
- Compiler: clang version 11.1.0
If that's not how the module should be compiled and imported, please tell me the correct way.