web-dev-qa-db-ja.com

gccのバージョンを確認する方法は?

In file included from /usr/include/c++/4.8.2/locale:41:0,
                 from /usr/include/c++/4.8.2/iomanip:43,
                 from [...omitted by myself as it is irrelevant]
/usr/include/c++/4.8.2/bits/locale_facets_nonio.h:59:39: error: ‘locale’ has not been declared
     struct __timepunct_cache : public locale::facet

上記は私のビルドログの最初のエラーです。

Glibc/gccを自分でコンパイルしようとはせず、yum経由でインストールしました。

私が見つけた魚のようなものの1つは次のとおりです。

$ ll /usr/include/c++/
total 4
drwxr-xr-x. 12 root root 4096 Dec 17 14:16 4.8.2
lrwxrwxrwx   1 root root    5 Dec 17 14:16 4.8.5 -> 4.8.2
$

そして、yumはgccの1つのバージョンのみを示しました:

$ yum info gcc-c++
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.uhost.hk
 * epel: mirrors.hustunique.com
 * extras: centos.uhost.hk
 * updates: centos.uhost.hk
Installed Packages
Name        : gcc-c++
Arch        : x86_64
Version     : 4.8.5
Release     : 4.el7
Size        : 16 M
Repo        : installed
From repo   : base
Summary     : C++ support for GCC
URL         : http://gcc.gnu.org
License     : GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
Description : This package adds C++ support to the GNU Compiler Collection.
            : It includes support for most of the current C++ specification,
            : including templates and exception handling.

/usr/include/c++/4.8.2のヘッダーを確認する方法は、実際に4.8.5パッケージからのものですか?

前もって感謝します。

P.S.おそらくglibcは無関係だと思いますが、ここに情報があります。

$ ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 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.
Written by Roland McGrath and Ulrich Drepper.
4
Hei

4.8.2ディレクトリへのシンボリックリンクは心配する必要はありません。RedHatEnterpriseLinux(したがってCentOS)のlibstdc ++ヘッダーがそのように配置されるのは正常です。

gcc --versionは、パス内のgcc実行可能ファイルのバージョンを示します。

rpm -q libstdc++-develは、C++標準ライブラリヘッダーを所有するパッケージのバージョンを示します。

rpm -ql libstdc++-develは、そのパッケージによってインストールされたファイルを一覧表示します。これには、/usr/include/c++/4.8.2の下のファイルが含まれます。

rpm --verify libstdc++-develは、C++ヘッダーを別のものに置き換えて、混乱していないことを確認します。

エラーはもっと心配です、それはあなたが何かを台無しにしたことを意味します。私の推測では、それはfrom [...omitted by myself as it is irrelevant]の部分にあり、実際には非常に関連性があるかもしれません。 std::locale<bits/locale_classes.h>の前に含まれる<bits/locale_facets_nonio.h>で宣言する必要があるため、宣言されていない場合は、_LOCALE_CLASSES_Hを定義し、標準を妨げるヘッダーがあると思います。ライブラリヘッダーが読み取られないようにします。アンダースコアで始まるインクルードガードを定義しないnot、それらは 予約名 です。

7
Jonathan Wakely

よくわかりませんが、以下に詳細を示します

Stackoverflow:libcのバージョン

$ /lib/x86_64-linux-gnu/libc.so.6 
GNU C Library (Ubuntu EGLIBC 2.19-0ubuntu6) stable release version 2.19, by Roland McGrath et al.
Copyright (C) 2014 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.
Compiled by GNU CC version 4.8.2.
Compiled on a Linux 3.13.9 system on 2014-04-12.
Available extensions:
    crypt add-on version 2.1 by Michael Glad and others
    GNU Libidn by Simon Josefsson
    Native POSIX Threads Library by Ulrich Drepper et al
    BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<https://bugs.launchpad.net/ubuntu/+source/eglibc/+bugs>.
mandar@ubuntu:~/Desktop$ 
1
Mandar

Linuxを使用しているので、試すことができます

 ldd --version
0
kiran