[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ error
From: |
Fredrik Salomonsson |
Subject: |
Re: C++ error |
Date: |
Tue, 12 Nov 2024 17:54:14 +0000 |
Hi,
Laurent Gatto <laurent.gatto@gmail.com> writes:
> Dear all,
>
> I have this very simple code chunk
>
> $ cat main.cpp
> #include <iostream>
>
> int main(void) {
> std::cout << __cplusplus;
>
> return 0;
> }
>
> That I can compile in a minimal shell
>
> $ guix shell --container gcc-toolchain
> [env]$ g++ main.cpp && ./a.out
> 201703
>
> However, on my main system, I get
>
> $ g++ main.cpp
> In file included from /home/lgatto/.guix-profile/include/c++/bits/move.h:57,
> from
> /home/lgatto/.guix-profile/include/c++/bits/exception_ptr.h:43,
> from /home/lgatto/.guix-profile/include/c++/exception:153,
> from /home/lgatto/.guix-profile/include/c++/ios:39,
> from /home/lgatto/.guix-profile/include/c++/ostream:38,
> from /home/lgatto/.guix-profile/include/c++/iostream:39,
> from main.cpp:1:
> /home/lgatto/.guix-profile/include/c++/type_traits:732:26: error:
> expected identifier before ‘(’ token
> 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout &&
> is_trivial instead")
> | ^
> /home/lgatto/.guix-profile/include/c++/type_traits:732:27: error:
> expected unqualified-id before string constant
> 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout &&
> is_trivial instead")
> |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/lgatto/.guix-profile/include/c++/type_traits:732:27: error:
> expected ‘)’ before string constant
> 732 | _GLIBCXX20_DEPRECATED("use is_standard_layout &&
> is_trivial instead")
> |
> ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | )
> /home/lgatto/.guix-profile/include/c++/type_traits:3154:25: error:
> expected unqualified-id before string constant
> 3154 | _GLIBCXX20_DEPRECATED("use is_standard_layout_v &&
> is_trivial_v instead")
> |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/lgatto/.guix-profile/include/c++/type_traits:3154:25: error:
> expected ‘)’ before string constant
> 3154 | _GLIBCXX20_DEPRECATED("use is_standard_layout_v &&
> is_trivial_v instead")
> |
> ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | )
>
>
> Other issues lead me to suspect that I lost support for C++17 and beyond.
>
> Any idea what/how I messed up and how to fix this?
What version is gcc on your main system? Could be that you somehow are
running an older gcc than what's in that .guix-profile.
I could compile that example just fine on mine.
Here is how g++ looks like on my machine, maybe that will help. Note
that I'm using guix home to install gcc-toolchain.
The version I'm using:
```
$ g++ --version
g++ (GCC) 11.4.0
Copyright (C) 2021 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.
```
>From where I'm picking up g++ from:
```
$ which g++
/home/plattfot/.guix-home/profile/bin/g++
```
Checking the stdc++ lib:
```
$ sed -n '3154p' ~/.guix-home/profile/include/c++/type_traits
_GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead")
```
Which matches what you have.
Here is the search paths gcc uses on my machine:
```
$ echo | g++ -E -Wp,-v -
ignoring nonexistent directory "/no-gcc-local-prefix/include"
ignoring nonexistent directory
"/gnu/store/w0i4fd8ivrpwz91a0wjwz5l0b2ralj16-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/../../../../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/home/plattfot/.guix-home/profile/include
/gnu/store/w0i4fd8ivrpwz91a0wjwz5l0b2ralj16-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/include
/gnu/store/w0i4fd8ivrpwz91a0wjwz5l0b2ralj16-gcc-11.4.0-lib/lib/gcc/x86_64-unknown-linux-gnu/11.4.0/include-fixed
/gnu/store/zvlp3n8iwa1svxmwv4q22pv1pb1c9pjq-glibc-2.39/include
End of search list.
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/home/plattfot/.guix-home/profile/include/stdc-predef.h" 1 3
# 0 "<command-line>" 2
# 1 "<stdin>"
```
--
s/Fred[re]+i[ck]+/Fredrik/g
- C++ error, Laurent Gatto, 2024/11/12
- Re: C++ error,
Fredrik Salomonsson <=
- Re: C++ error, Laurent Gatto, 2024/11/12
- Re: C++ error, Fredrik Salomonsson, 2024/11/12
- Re: C++ error, Laurent Gatto, 2024/11/13
- Re: C++ error, Fredrik Salomonsson, 2024/11/13
- Re: C++ error, Laurent Gatto, 2024/11/13
- Re: C++ error, Fredrik Salomonsson, 2024/11/14
- Re: C++ error, Laurent Gatto, 2024/11/16
- Re: C++ error, Laurent Gatto, 2024/11/16
- Re: C++ error, Fredrik Salomonsson, 2024/11/18
- Re: C++ error, Laurent Gatto, 2024/11/21