gcc5

incomplete type for std::unordered_set compiling error in g++5, compiles in clang++

我只是一个虾纸丫 提交于 2020-01-21 18:34:55
问题 Consider the code related to a previous SO question C++ cyclic dependency confusion with adjacency list representation #include <cstddef> #include <unordered_set> class Node; class Hash { public: std::size_t operator()(const Node &node) const; }; class Node { public: int data; std::unordered_set<Node, Hash> links; }; inline size_t Hash::operator()(const Node &node) const { return node.data; } int main() { } This code does not compile when using g++4.9.2 or g++5, however compiles with clang++3

Runtime error [abi:cxx11] when compile with g++-4.9 on Ubuntu 15.10

妖精的绣舞 提交于 2019-12-24 17:29:49
问题 I recently updated Ubuntu from 15.04 to 15.10. One of the major differences between these versions is the update of the default gcc version from gcc-4.9 -> gcc-5. The library I'm developing has been written and compiled for gcc-4.9, and relies on other libraries which only work in gcc-4.9. I have installed gcc-4.9 onto my computer, and I can successfully compile both the library and my source file. However, when I tried to run the resultant program I get this error: terminate called after

The program runs 3 times slower when compiled with g++ 5.3.1 than the same program compiled with g++ 4.8.4, the same command

人盡茶涼 提交于 2019-12-20 17:38:30
问题 Recently, I've started to use Ubuntu 16.04 with g++ 5.3.1 and checked that my program runs 3 times slower . Before that I've used Ubuntu 14.04, g++ 4.8.4. I built it with the same commands: CFLAGS = -std=c++11 -Wall -O3 . My program contains cycles, filled with math calls (sin, cos, exp). You can find it here. I've tried to compile with different optimization flags (O0, O1, O2, O3, Ofast), but in all cases the problem is reproduced (with Ofast both variants run faster, but the first runs 3

Valgrind Unrecognised instruction

拥有回忆 提交于 2019-12-17 16:32:08
问题 I have the following code: #include <iostream> #include <random> int main() { std::mt19937_64 rng(std::random_device{}()); std::cout << std::uniform_int_distribution<>(0, 100)(rng) << '\n'; } I try to profile it using valgrind , but it says: vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1 vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0 vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0 ==2092== valgrind:

Cannot decode an obscured compiler error in g++ when user custom hash function in unordered_map

喜欢而已 提交于 2019-12-13 14:15:56
问题 Here is the code I am trying to compile: #include <unordered_map> #include <unordered_set> #include <algorithm> #include <iostream> #include <sstream> #include <vector> #include <string> using namespace std; namespace _LEET_MAX_POINTS_ON_A_LINE { struct Point { int x; int y; Point() : x(0), y(0) {} Point(int a, int b) : x(a), y(b) {} }; struct SlantedLine { public: int slope_numerator; int slope_denominator; int intercept_numerator; int intercept_denominator; }; struct SlantedLineHash { size

how to compile Ignite application on CMake?

北慕城南 提交于 2019-12-13 03:45:47
问题 I did compile Ignite Application successfully. but The Binary didn't work. /tmp/tmp.Nw0IPD6ru3/cmake-build-debug-local-container/planet_engine: error while loading shared libraries: libjvm.so: cannot open shared object file: No such file or directory how can I make to it work? Also, I compiled C++ Examples successfully. such as ignite-compute-example. and, I execute that but I got an error message. An error occurred: JVM library is not found (did you set JAVA_HOME environment variable?) and I

Undefined reference when linking with Boost using g++-4.9 on a g++-5-ish distribution

北城余情 提交于 2019-12-13 02:15:21
问题 I've written the following groundbreaking application: #include <boost/program_options.hpp> int main(int argc, char** argv) { boost::program_options::options_description generic_options("foo"); return 0; } I am trying to build this on Debian Stretch, on which the default compiler is GCC 5.3.1-5, and the installed version of Boost is 1.58.0. However, for reasons which I will not go into here (which would be apparent had this not been a MCVE), I need to compile and link the binary using g++-4.9

Lvalue istringstream Required for istream_iterator?

痞子三分冷 提交于 2019-12-12 03:28:33
问题 Given a string foo in Visual Studio I can break the words into a vector by doing: vector fooVec{ istream_iterator<string>(istringstream(foo)), istream_iterator<string>() }; But this won't compile in gcc 5.1. I get the error: invalid initialization of non-const reference of type std::istream_iterator<std::basic_string<char> >::istream_type& {aka std::basic_istream<char>& } from an rvalue of type std::basic_istream<char> Now I know that gcc had a bug that was fixed by our own Jonathan Wakely.

error with gcc 5 for varargs function: suffix or operands invalid for `movq'

試著忘記壹切 提交于 2019-12-11 10:51:40
问题 When trying to install OpenMPI the .configure filed failed in the section checking for ISO C99 ability of the selected compiler. Puzzled as gcc of course has both the std=gnu99 and std=c99 option, I pruning the 20,000 lines configure file to isolate the offending section. In the end I traced it back to gcc 5 not compiling variable argument functions. The below code generates the "suffix or operands invalid for `movq'" error, which is the root cause of the .configure file failing. (The step-by

error: 'log2' is not a member of 'std'

ⅰ亾dé卋堺 提交于 2019-12-08 03:30:10
问题 I'm not sure what I am seeing here. The test results below are from an old PowerMac G5 running OS X 10.5.8. Its still around for testing under the big-endian PowerPC cpu. The compiler is GCC 5.4, and its provided by MacPorts. The test program is below. Compiling it results in an error error: 'log2' is not a member of 'std' . $ cat test.cxx #include <cmath> int main(int argc, char* argv[]) { double d = std::log2(2.3456789f); return 0; } According to Is std::log2() an extension or C++ standard?