2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gcc (g++) 4.9でGNU MPをコンパイルする時のメモ

Last updated at Posted at 2016-01-02

WandboxのGNU MPを触っていて引っ掛かったこと:

Header <cstddef> changes

The <cstddef> header was updated for C++11 support and this breaks some libraries which misuse macros meant for internal use by GCC only. For instance with GMP versions up to 5.1.3, you may see:

/usr/include/c++/4.9.0/cstddef:51:11: error: ‘::max_align_t’ has not been declared
using ::max_align_t;
^

Another possible error is:

someheader.h:99:13: error: ‘ptrdiff_t’ does not name a type

A workaround until libraries get updated is to include <cstddef> or <stddef.h> before any headers from that library.

とのことで,ワークアラウンドとしてstddef.hを先に読むようにとのこと.

GNU MPのgmp.hにはC++言語用のコードが混ざっていて,それが悪さをすることがあるので,ヘッダファイルを読む順番は気をつけた方が良さそう.

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?