-
Notifications
You must be signed in to change notification settings - Fork 413
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
Missing -std=c++11 when compiling C++ files #10886
Comments
To be pendantic I suggest that Dune checks that the C++ compiler it uses defaults at least to C++11. This can be checked with $ cc -dM -E -x c++ - < /dev/null | grep __cplusplus
#define __cplusplus 199711L
$ cc --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
$ /opt/homebrew/Cellar/llvm/18.1.8/bin/clang -dM -E -x c++ - < /dev/null | grep __cplusplus
#define __cplusplus 201703L
$ /opt/homebrew/bin/gcc-14 -dM -E -x c++ - < /dev/null | grep __cplusplus
#define __cplusplus 201703L You see here that Apple clang 15 defaults to C++98, but clang and gcc installed via Homebrew default to C++17. MSVC defaults to C++14, so that's fine. |
Note that clang-16 shipped with the new macOS 15.0 Sequoia still defaults to C++98. |
@MisterDA do you want to send a PR? |
I don't think that passing a specific version of C++ is the way to go… I would rather have Dune detect the version of C++ the C++ compiler defaults to, if there are C++ stubs, and pass |
If this is to avoid issues with having the option overwrite the default or a user-given
|
Makes sense.
We could also default to C++11 for all OCaml 5 versions. |
I opened #10962 to fix this |
See ocaml/ocaml#13422
OCaml 5.3 requires
-std=c++11
to be passed when C++ is used.From what i understand Dune 3 passes
+x c++
automatically to the C compiler so it should probably also add this option too.The text was updated successfully, but these errors were encountered: