Finn
Finn

Reputation: 334

CLion support for C++ concepts

Apparently CLion supports concepts now.

However I can't even get the official example to work.

On the std::convertible... CLion shows an error Expected concept name with optional arguments.

When I try to compile it, it tells me to add the -fconcepts flag. When I do that and compile again, I get the error

make: concepts: No such file or directory
make: *** No rule to make target 'concepts'.  Stop.

I could't find anyone with a similar issue, just found some tutorials on how to get it to work with earlier versions of CLion, which - as far as I can see - don't apply here.

I'm using CLion 2020.2 Build #CL-202.6397.106, built on July 28, 2020, which should be the newest one. At least I don't see any updates.

Upvotes: 2

Views: 526

Answers (1)

florestan
florestan

Reputation: 4655

I was able to run the cppreference example with CLion 2020.2. The problem why it wasn't working initially for me was that the gcc compiler on my system (Ubuntu 20.04) was too old (9.2). I tried with the packaged g++10, but that still didn't work, so I had to compiler gcc-10.2 directly from the git sources. That finally made it work.

Also make sure you add set(CMAKE_CXX_STANDARD 20) to your CMakeLists.txt.

Upvotes: 1

Related Questions