Boost Unit Test Problems
-
Hi all. I'm new to Qt and also fairly new to Boost (especially on my personal devices). I'm trying to make a very simple Boost program just to see if I can get it to work, but I'm having some major problems just building it.
I created a new project and added the following lines to the .pro file:
INCLUDEPATH += C:\boost_1_68_0 LIBS += C:\boost_1_68_0\boost\test\included\unit_test.hpp
I also created the following test file:
#include <main.h> #define BOOST_TEST_MODULE MyTest #include <boost/test/unit_test.hpp> BOOST_AUTO_TEST_CASE(MyTest) { BOOST_CHECK_EQUAL(makeInt(), 5); }
The issues come from when the test file is being built. I repeatedly get the error:
C:\boost_1_68_0\boost\test\included\unit_test.hpp:18: error: boost/test/impl/compiler_log_formatter.ipp: No such file or directory #include <boost/test/impl/compiler_log_formatter.ipp> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For some reason, the .ipp files that unit_test.hpp is including can't be found by it. I have verified that the files it is trying to find are in the location it is supposedly searching, but it just isn't getting them. I've tried messing with the INCLUDEPATH and LIBS but to no avail, and I've not found anyone else having this specific problem.
I assume I'm missing something extremely simple, so does anyone know what's going wrong here?
-
Hi and welcome to devnet forum
@Conical said in Boost Unit Test Problems:
I created a new project and added the following lines to the .pro file:
INCLUDEPATH += C:\boost_1_68_0 LIBS += C:\boost_1_68_0\boost\test\included\unit_test.hpp
Change the back slashes '\' to forward slashes '/' in the folder references.
You need to use forward slashes alaso for windows. Back slashes have a special meaning and are used at end of line for continuation on next line.
-
@koahnig said in Boost Unit Test Problems:
Change the back slashes '' to forward slashes '/' in the folder references.
Hi. I made these changes, but I'm still receiving the same build error I was before.
Thank you for the advice, though.
@koahnig said in Boost Unit Test Problems:
unit_test.hpp is an include file which shall be already correctly included with INCLUDEPATH
I removed the LIBS line, but all that did was break things even further, and caused several "undefined reference" errors in my tests file. Are you sure I don't need that line?
-
The INCLUDEPATH seems to be correct. At least what you are showing.
I do not know the test library feature of boost. However, I know that some features require separate compilation which will create libraries. This would be for the regular expression of boost for instance. Those libraries need to be referenced with LIBS statement.
https://doc.qt.io/qt-5/qmake-variable-reference.html#libs