This is because your library was built without BOOST_TEST_ALTERNATIVE_INIT_API.
Having looked at the documentation, it suggests that I only need to build the library with BOOST_TEST_NO_MAIN if I want to supply my own main. Why do I also need to also build with BOOST_TEST_ALTERNATIVE_INIT_API?
Why did you specify it in your test module? The value of this macro should be the same both during library build and when you build test module.
I found out that including the following file:
#include
Single header version will work indeed.
I'm not sure I understand. Can you elaborate?
Single header version build both framework and your test module simultaneously. Obviously this resolved the issue with discrepancy in BOOST_TEST_ALTERNATIVE_INIT_API value.
resolves this problem but I'm confused about the implications.
Your only implication is that you will have to spend a bit more time on compilation (maybe negligible, if you have enough power) and you have to stick with single file test modules.
Again, can you please elaborate?
What specifically you want me to elaborate on? Single header might take a bit more time to build and only allow you to use one test file per test module.
And just to clarify, if I want to provide my own main function, I *must* build the library with at least BOOST_TEST_NO_MAIN.
If you are building static library - yes.
Under what circumstances would I also build it with BOOST_TEST_ALTERNATIVE_INIT_API?
It is up to you. You need to make sure you set the same value when you build library and test module.