How to set clangd (eglot) to C++20? - c++

I'm not quite sure if this is the right place to ask such a question, but you could help me a lot with any hint you have! So I'm using eglot and clangd as my lsp, and I want to set clangd C++ standard to C++20.
I have tried to put -std=c++20 in compile_commands.json for every file in my project, but this haven't done any effect. Any help would be much appreciated!

Thank you so much #marcinj ! Just using -std=c++2a stead of -std=c++20 fixed it!

Related

Anyway to set gcc to c++11 as default in terminal

Im running through some basic exercises in c++ and some of the structures are not allowed in c++98 mode. Is there anyway I can just set gcc to always compile in c++11 and not c++98. Right now I need to add the -std=c++11 flag in terminal. I read a previous post about using a Makefile. Adding a MakeFile for every directory im running these exercises in seems a bit tedious, is there anyway around that? Im a bit new to altering my compiler so any advice would be appreciated!
Im on a windows 10 machine using powershell at the moment.

How to enable C++11 support in Eclipse?

I know there are a lot of answers, but no one is useful.
Ubuntu 16.04
Eclipse 4.6.2
I have tried every solution including:
Add -std=c++11 or c++14 or c++0x or gnu++0x or gnu++11 in the "Command to get compiler specs".
Add __GXX_EXPERIMENTAL_CXX0X in the "Symbols".
Add __cplusplus and set value to 201402L.
So I just wonder, why can't the developer just design an option to enable it?
Does any one have solution?
Oh am I forgot to rebuild? No.
To provide more information, I use a custom script to build my *.cpp. And I think build options won't affect the recognizance right?
Sorry about missing "11".
While your question is not very clear to me, I would like to recommend using eclipse-cdt
It comes as a plugin for eclipse. Please use the eclipse update manager to install this plugin and get started with your C++ development work.

Compiling MPI with mingw

I don't seem to be finding anything on this, or quite like this. I have this code that we want working with windows, so I've been using mingw and working to modify the code so it compiles. However, I ran into a big issue. The issue is entirely with Microsoft MPI. Our code includes and uses MPI for parallelization code. When the mingw compiler gets to the mpi portion, it tries to compile mpi.h and fails right away, because the overhead like (MPI_Offset and MPI_Count) are not declared in the header file (IIRC, they're usually done during compile time by mpicc or whatever, but MS-MPI doesn't do things that way, not really sure how it does things), it comes up with a bunch of "has not been declared" errors. How can I fix this? I really have no clue how MS-MPI works and the microsoft resources I've found do not help. I keep seein something about a cross platform mingw compiler, but I'm not sure what that is or how I'd use it. I have pretty much no experience compiling things outside of visual studio, and am only beginning to get familiar with mingw. Even pointers on where to look would be appreciated.
Interestingly enough, adding #include to the top of MS-MPI's mpi.h worked.
You may try mpich2. mpich2-v1.4.1p1 is the last version support windows officically. It also supports the MinGW and gfortran.
As stated in the mpich2's website, the msmpi is just a branch of mpich2 version 1.

Which version of openMP is supported by icpc 13.01?

I'm using the icpc, version 13.01 for compiling my c++ code. Since I want to use openMP for parallelization, I want to know which version of it is supported by the compiler. I found some methods to find it out for g++ compiler, but not for ipcp... Can anyone offer a hint?
If it's iteresting for someone else: After spending more time on research I found out, that it should support openmp version 3.1:
https://software.intel.com/en-us/articles/intel-c-and-fortran-compilers-now-support-the-openmp-31-specification/
The comment of Jeff also is very helpful!

Why can't Eclipse find regex on Mac OSX?

I'm using Eclipse Juno on OSX Mountain Lion and wanted to use std::regex, which I know is a C++11 only feature. When I #include <regex> the IDE says it doesn't exist. Maybe it's good to note that the header regex.h is present /usr/include/, though I see no specific library for it in /usr/lib/ or /usr/local/lib/, though I'm not aware if that's relevant. This is just a side project for fun so I'm not using a customized build system, just a regular C++ project in Eclipse.
I'm not real experienced when it comes to modifying a build process (other than setting include paths, libraries, etc.), especially when an IDE like Eclipse is driving it, but my assumption is that the compiler and linker (GCC G++) isn't configured for C++11, though I've tried various recommendations from SO and the Eclipse forums, like adding -std=c++11, but I just keep seeing output saying that they're unrecognized arguments.
I'm sure someone out there has dealt with this issue. Can anyone help? Thanks in advance.
On mac you have to use the flag:
-stdlib=libc++
and even then I believe generally only clang is updated enough(so use clang instead of gcc), if you've just been using the Xcode updates. You should also make sure that your Xcode command line tools are updated, because I would guess that is the compiler eclipse is using.