Skip to content
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

build example error on gcc 4.8 . #2333

Closed
aengusjiang opened this issue Apr 9, 2022 · 11 comments
Closed

build example error on gcc 4.8 . #2333

aengusjiang opened this issue Apr 9, 2022 · 11 comments

Comments

@aengusjiang
Copy link
Contributor

in file: bin_to_hex.h

#if defined(__has_include) && __has_include()

include

#endif

error: missing binary operator before token "("
#if defined(__has_include) && __has_include()

@gabime
Copy link
Owner

gabime commented Apr 9, 2022

Thanks. which compiler version?

@aengusjiang
Copy link
Contributor Author

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and the spdlog version:1.10

@aengusjiang
Copy link
Contributor Author

step:
cmake -B build .
cd build
make

then the error as below:
image

@gabime gabime changed the title build example error on Centos7.9:__has_include build example error on gcc 4.8 . Apr 9, 2022
@gabime
Copy link
Owner

gabime commented Apr 9, 2022

I dont have gcc 4.8 to reproduce. Please open a pr with a fix.

@aengusjiang
Copy link
Contributor Author

aengusjiang commented Apr 9, 2022 via email

@gabime
Copy link
Owner

gabime commented Apr 9, 2022

Create a pull request with the fix.

@aengusjiang
Copy link
Contributor Author

aengusjiang commented Apr 9, 2022 via email

@gabime
Copy link
Owner

gabime commented Apr 9, 2022

so maybe surround with ifdef?

@aengusjiang
Copy link
Contributor Author

it works on gcc version 8.3.1 20191121,
but I try to surrond with ifdef like below:
--- a/include/spdlog/fmt/bin_to_hex.h
+++ b/include/spdlog/fmt/bin_to_hex.h
@@ -8,9 +8,13 @@
#include
#include <spdlog/common.h>

+// __has_include feature require c++17 standard
+// see https://gcc.gnu.org/projects/cxx-status.html
+#if 201703L <= __cplusplus
#if defined(__has_include) && __has_include()

include

#endif
+#endif
then, it still has error:
image

I think that the user_defined_example requre the higher gcc version to support the template specialization.
That is say it don't support with low version such gcc4.8.5.

kslattery pushed a commit to kslattery/spdlog that referenced this issue May 11, 2022
gabime added a commit that referenced this issue May 13, 2022
C++14 build fixes for older gcc #2333
@kslattery
Copy link

@gabime Should be able to close this issue and #2354.

@gabime gabime closed this as completed May 13, 2022
This was referenced Dec 13, 2022
@stephen-derosa
Copy link

what was the solution here for building on gcc < 9? Just to upgrade gcc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants