Closed Fytch closed 9 months ago
I tried to reproduce your example but for me it successfully compiled with g++-11. I took the source code and executed the following commands:
export CXX=g++-11
mkdir build
cd build
cmake ..
make
Can you try whether this also works on your machine? Or can you provide me with a complete example (in the form of a zip file) that I can try on my machine?
I was able to compile your example and I have been able to track down the key difference between your example and my project: C++20. After adding set(CMAKE_CXX_STANDARD 20)
to the CMakeLists.txt file that you have have provided, the same error occurs again:
Consolidate compiler generated dependencies of target getting_started
[ 50%] Building CXX object CMakeFiles/getting_started.dir/main.cc.o
In file included from /home/fytch/.hunter/_Base/093bd9a/cb3d9e0/9d0461e/Install/include/lf/base/base.h:56,
from /home/fytch/.hunter/_Base/093bd9a/cb3d9e0/9d0461e/Install/include/lf/mesh/entity.h:4,
from /home/fytch/.hunter/_Base/093bd9a/cb3d9e0/9d0461e/Install/include/lf/mesh/mesh.h:22,
from /tmp/tmp.5p8U0hwfNe/main.cc:1:
/home/fytch/.hunter/_Base/093bd9a/cb3d9e0/9d0461e/Install/include/lf/base/span.h:1499:15: error: missing binary operator before token "("
1499 | (span_HAVE(BYTE) || span_HAVE(NONSTD_BYTE))
| ^
make[2]: *** [CMakeFiles/getting_started.dir/build.make:76: CMakeFiles/getting_started.dir/main.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/getting_started.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Clang 12 reports the same problem with C++20 enabled:
In file included from /tmp/tmp.5p8U0hwfNe/main.cc:1:
In file included from /home/fytch/.hunter/_Base/093bd9a/fa1abb1/9d0461e/Install/include/lf/mesh/mesh.h:22:
In file included from /home/fytch/.hunter/_Base/093bd9a/fa1abb1/9d0461e/Install/include/lf/mesh/entity.h:4:
In file included from /home/fytch/.hunter/_Base/093bd9a/fa1abb1/9d0461e/Install/include/lf/base/base.h:56:
/home/fytch/.hunter/_Base/093bd9a/fa1abb1/9d0461e/Install/include/lf/base/span.h:1499:6: error: function-like macro 'span_HAVE' is not defined
(span_HAVE(BYTE) || span_HAVE(NONSTD_BYTE))
^
1 error generated.
make[2]: *** [CMakeFiles/getting_started.dir/build.make:76: CMakeFiles/getting_started.dir/main.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/getting_started.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Compiler version:
clang version 12.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Okay, I think the problem is resolved, at least the small sample program that you provided compiles now in c++20 mode. If you use LehrFEM++ via hunter in your project, you will have to use the absolutely latest version (de186a85b1824f669f6deb5033f3c9bdafb6abed) of the master branch (see "Use Cutting Edge Version of LehrFEM++" in the getting started guide).
Can you please check if it works for you now?
Thank you for looking into this! I will come back to you in a couple of days after I've had my last exam.
Yet again, lehrfempp does not compile. After a long search, I've reduced the error to the following snippet:
Relevant compiler call:
Compiler output:
Compiler version: