-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Errors when linking a library built with boost.json to a unit test executable #1042
Comments
This looks like a problem with Boost.Container. If my guessing is correct, some Container header is missing an include. Can you please include |
ok, Here is the result |
Can you please post the contents of that file? |
#ifndef BOOST_CONTAINER_DETAIL_PLACEMENT_NEW_HPP #include struct boost_container_new_t{}; //avoid including inline void operator delete(void *, void *, boost_container_new_t) #endif //BOOST_CONTAINER_DETAIL_PLACEMENT_NEW_HPP |
Is there really nothing in the line after |
#include "cstddef" |
Ok, now what happens if you don't include the Container header, and instead put the following? #include <cstddef>
std::size_t n; BTW, if you want to put a bunch of code in a GH comment, use triple backticks (```) before and after it. |
[main] Building folder: C:/Users/BIZZ/Documents/Vscode/Projects/Stock_Market_Simulator/build/MinGW Debug Config It builds successfully after hiding std::size_t n and the boost.json functions i used |
Now, please try #include <cstddef>
struct boost_container_new_t{};
inline void *operator new(std::size_t, void *p, boost_container_new_t)
{ return p; } |
[main] Building folder: C:/Users/BIZZ/Documents/Vscode/Projects/Stock_Market_Simulator/build/MinGW Debug Config |
I am at a loss. Are you sure #include <cstddef>
std::size_t n = 1; compiles? The only reason for your error I can imagine is that BTW, what compiler flags are you using to build? |
The problem is the macro definition at line 83 of CppUTest/MemoryLeakDetectorMacros.h as visible on the screenshot above. |
It compiles but with std::size_t commented out. |
What @pdimov said. CppUTest defines a macro that messes up |
Please, do you have any suggestions? |
You need to include the CppUTest headers last, after the Boost.JSON headers (and probably after everything else to avoid similar issues elsewhere.) |
Unfortunately, that does not seem to fix the issue |
Well, it should fix the issue of errors in Boost headers. The macro definition can't affect declarations before it. What's the error you're getting now? |
includes in the UnitTest.cpp
boost/json/src.hpp is declared in the alphavantage.hpp The errors are still the same |
Does |
Closing as there was no response. |
PLEASE DON'T FORGET TO "STAR" THIS REPOSITORY :)
Version of Boost
Version 1.85.0-4 from the msys2 mingw-w64-boost package
![boost1](https://private-user-images.githubusercontent.com/149373399/368158518-4807ecfc-4b49-4ae5-9595-49712de86e9e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4OTEyMzMsIm5iZiI6MTczOTg5MDkzMywicGF0aCI6Ii8xNDkzNzMzOTkvMzY4MTU4NTE4LTQ4MDdlY2ZjLTRiNDktNGFlNS05NTk1LTQ5NzEyZGU4NmU5ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxOFQxNTAyMTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lYjcyY2FiN2Q5YTA2OTMzOGU5NzBjZTIxMjdmMmZkMDY2NDFlYTM3YTg2YzM5MTVkMTE0ODczMWJlYTA4ZWNlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.La4y9lYpGc41FZ1o-ebzFlhcVw1Fwr-Zdzfyqivn9Wg)
![boost2](https://private-user-images.githubusercontent.com/149373399/368158692-8e1c0602-61cb-420d-8956-9cd46e16c405.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4OTEyMzMsIm5iZiI6MTczOTg5MDkzMywicGF0aCI6Ii8xNDkzNzMzOTkvMzY4MTU4NjkyLThlMWMwNjAyLTYxY2ItNDIwZC04OTU2LTljZDQ2ZTE2YzQwNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxOFQxNTAyMTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lMzliOWMyNjYyOTNkMjgyNWYzZWVhM2U2NzI0YzA2ZGNmOTA1MjBmOTE0MWNlMmJhMzMwNGYxNGU2MTFiNzUxJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.a_u0d9Z6KdpjW78ut8hZN8syRh-VYTu6qcV7y9BksuY)
Steps necessary to reproduce the problem
CMakeLists.txt for build the unit test
add_executable(unitTest UnitTest.cpp)
target_link_libraries(unitTest
PRIVATE httpClientMock CppUTest::CppUTest
CppUTest::CppUTestExt)
cpputest_discover_tests(unitTest)
All relevant compiler information
g++ (Rev1, Built by MSYS2 project) 14.2.0
I've tried building both the header-only build and builds dependent on the static boost_json library but they both produce the same similar errors.
The text was updated successfully, but these errors were encountered: