问题标签 [gcc5]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
5546 浏览

c++ - GCC 5.3 中的新选项:-fno-semantic-interposition

GCC 5.3 添加了一个新选项:-fno-semantic-interposition

新的 -fno-semantic-interposition 选项可用于提高不允许插入导出符号的共享库的代码质量。

这听起来对 C++ 项目很有用,在这些项目中,无论出于何种原因都不能使用插入,但延迟是一个问题。

但是,描述相当模糊。有没有人能够澄清这个选项是如何工作的?

0 投票
2 回答
4669 浏览

raspberry-pi2 - Raspberry Pi - 致命错误:sys/cdefs.h:没有这样的文件或目录

我正在尝试使用最新的 Raspbian 系统映像在我的 Raspberry Pi 上编译 gcc5.3.0。

但是,原来的编译器(gcc4.9)在编译 libgcc 时抱怨没有创建 sys/cdefs.h。

我检查了我有libc6-devbuild-essential安装了。

所以我过去grep -R 'cdefs' /usr/include/搜索它,我在/usr/include/bsd/找到了它。我创建了 sys 目录并在 /usr/include/bsd/sys 下创建了指向这些头文件的硬链接。

这次它给了我一个更奇怪的错误,/usr/include/stdio.h:312:8: error: unknown type name 'FILE'。

我在stackoverflow上搜索了这个,有一个类似的问题,https://stackoverflow.com/a/21047237/5691005。但是当我删除/usr/include/sys和/usr/include/bsd,然后重新安装libc6-dev时,我在/usr/include下找不到sys/cdefs.h,编译器仍然报错。

我现在完全迷路了。任何建议将不胜感激。

0 投票
1 回答
1498 浏览

c++ - 当用户在 unordered_map 中自定义哈希函数时,无法解码 g++ 中的模糊编译器错误

这是我要编译的代码:

该代码在 Visual Studio 2015 上编译得很好(带有一些不相关的警告),但在 g++ 上却惨遭失败(如在 ideone 上:https ://ideone.com/d1Rs1I )

以下是编译器输出:

编译器错误输出看起来与此线程上发布的非常相似。

以 std::pair 作为键创建 std::unordered_map

但我确信我的哈希函数是 const 的。不知道为什么它仍然抱怨我的哈希函数不是 const。

0 投票
1 回答
2311 浏览

c++ - 在 Ubuntu 15.10 上使用 g++-4.9 编译时出现运行时错误 [abi:cxx11]

我最近将 Ubuntu 从 15.04 更新到 15.10。这些版本之间的主要区别之一是默认 gcc 版本从 gcc-4.9 -> gcc-5 的更新。我正在开发的库是为 gcc-4.9 编写和编译的,并且依赖于仅在 gcc-4.9 中工作的其他库。

我已经在我的计算机上安装了 gcc-4.9,我可以成功编译库和我的源文件。但是,当我尝试运行生成的程序时,出现此错误:

源代码和我在这里尝试阅读的文件在升级之前可以正常工作。我曾尝试使用该-D_GLIBCXX_USE_CXX11_ABI=0标志,但我不确定这是正确的做法,它也不起作用。

这是我当前包含在我的 makefile 中的标志的一个示例:

有什么想法可以帮助我吗?

0 投票
2 回答
13165 浏览

c++ - Is C++17 std::shared_mutex not available yet?

Looking at C++ compiler support, it appears that the untimed version of std::shared_mutex is available in GCC 5.0+. However, even with gcc version 5.3.0 20151204 (Ubuntu 5.3.0-3ubuntu1~14.04), and compiling with -std=c++1z, a simple initialization of a shared mutex ends up with:

And no, I have already included the proper header: #include <shared_mutex>.

It can't locate the proper header, because it does not seem to exist. Actually, the linker uses the library locate at /usr/include/c++/5/shared_mutex, which contains only the implementation of the std::shared_timed_mutex (like the C++14 standard).

I have installed gcc-5 and g++-5 by adding the repository at ppa:ubuntu-toolchain-r/test and using update-alternatives to properly set up their bins.

Is there something I can do to compile my code correctly using the newest C++17 standard? And probably is a stupid question to ask, but is it too early to start using -std=c++1z even if it should be already supported? Because it is supported, right?

0 投票
5 回答
168135 浏览

gcc - 如何在 CentOS 7.2 上使用 yum 安装 gcc 5.3?

我正在使用 CentOS 7.2

当我使用yum groupinstall "Development Tools"时,gcc 版本是 4.8.5,如下所示:

在此处输入图像描述

我想安装 gcc 5.3

如何解决这个问题yum

0 投票
1 回答
2283 浏览

c++ - 如何配置 Qt 来构建所有模块?

我正在按照指南从源代码构建 Qt,但构建似乎不完整,我正在使用以下配置进行构建:

配置 -prefix E:\Qt57b_static_mingw5_64 -release -developer-build -opensource -c++std c++1z -static -no-accessibility -platform win32-g++ -qt-zlib -qt-libpng -qt-libjpeg -qt- freetype -no-compile-examples -no-icu -opengl desktop -skip qtscript -nomake 示例 -nomake 测试

然后jom -j 1615 分钟后“完成”。

我还注意到它没有在前缀目录中安装任何东西,并且从时间戳看来,构建没有触及大多数模型文件夹。它只构建 qtbase 和其他一些较小的模块,它们确实包含静态库,但其余的没有被构建。

为了构建所有东西,我需要做一些特别的事情吗?上次我构建 Qt 时并非如此。或者配置有问题?或者 GCC5 可能与 Qt 有问题?在我总是用 4.9 构建之前。我也在构建一个测试版。

平台是win 7 x64,mingw-w64-i686-gcc 5.3.0-1

编辑:运行影子构建后,我注意到配置确实只qtbase为构建做准备,其余的都没有构建。

0 投票
1 回答
11941 浏览

c++ - Valgrind 无法识别的指令

我有以下代码:

我尝试使用 来分析它valgrind,但它说:

前面有多个实例:

我在 Debian 上使用 x86-64 平台上的标准包,使用 valgrind-3.11.0 使用 gcc 5.3.1 编译。非法指令似乎在 libstdc++6 中。

如何valgrind分析我的代码?

0 投票
3 回答
78 浏览

c++ - 从 MSVC2015 更新 2 移植到 GCC 5.3 - SFINAE 错误

我目前正在移植我的库,但我的黑暗模板魔法不会用 GCC 5.3 编译

此片段在使用 MSVC2015 Update 2 编译时按预期工作

GCC 抱怨“当前范围内未定义 vreal(WTF?)”

到目前为止我已经尝试过:

将上面的模板片段重写为

但这也不起作用。它在代码的后期中断了很多,我认为这是由于引入了额外的模板参数。

另外,我不明白为什么我必须引入与 0 的比较。没有它,gcc 抱怨在 enabled_if 上缺少“类型”。

所以,主要问题是:如何在没有额外参数的情况下获得相同的 SFINAE 逻辑(仅在参数为 vreal 时编译)。

我可以重写它以返回 SFINAE 类型——但这将是很多我想避免的工作(区分函数、类、结构、typedefs / usings ...),即使它包含在宏中。

0 投票
1 回答
510 浏览

xcode - 在 Xcode 6 上安装 GCC 5.X

我需要在 Xcode 6.2 上使用/集成 GCC 5.X(在我的情况下是 5.3,并且它已经安装)。

我发现了很多关于 GCC 4.X 和 Xcode 5(或更低版本)的过时教程,但是它们都已经过时并且不再工作了。

我也找到了这个教程,但我没有 tuto 建议复制的 5.3.xcplugin 文件。

我仍在使用 Mac OS X Maverick,如有必要,我可以安装 Xcode 7。

有人会知道怎么做吗?