fix: compilation error with libc++ #784
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I use Crow on Windows, MacOS, and Linux. On Windows, I compile with the MSVC compiler, while on MacOS and Linux, I use the Clang compiler. It works well.
The issue arose when migrating from my local development environment on Linux (WSL, Ubuntu Preview 24.04 daily live) to a cloud server (Debian 12). Since Debian 12 lacks the latest Clang compiler and C++ Library, I had to install libc++ as a replacement for libstdc++, which led to compilation problems. Subsequently, linking the version that ran correctly on WSL to libc++ instead of libstdc++ also resulted in the same issue.
After searching for relevant information in this repository, I found that issues #229, #481, and #636, as well as pull requests #229 and #634, might be related. After modifying json.h, my code compiled and ran successfully.
I'm unsure if
_LIBCPP_VERSION
would be defined underdefined(__APPLE__) || defined(__MACH__) || defined(__FreeBSD__) || defined(__ANDROID__)
, so I didn't remove the conditional checks in the original code. Instead, I added checks for_LIBCPP_VERSION
directly after them. If possible, you can further investigate this.I'm a beginner in C++, and English is not my first language, so please forgive any inaccuracies in my wording.