gcc4.8

Unknown type name ‘off64_t’

谁都会走 提交于 2019-12-03 23:38:56
I have a problem using Apache Portable Runtime on Ubuntu with GCC 4.8.1 The problem is that the off64_t from <sys/types.h> is not available when compiling with gcc . (When compiling with g++ everything work fine) Does anybody know which compiler switch to use to enable off64_t ? (I know that defining _LARGEFILE_SOURCE _LARGEFILE64_SOURCE avoids the problem, but wondering if this is the right way) To reproduce the error one can simply try to compile the following code: #include <sys/types.h> off64_t a_variable; off64_t is not a language defined type. No compiler switch will make it available.

Is GCC loop unrolling flag really effective?

旧巷老猫 提交于 2019-12-03 04:59:28
问题 In C, I have a task where I must do multiplication, inversion, trasposition, addition etc. etc. with huge matrices allocated as 2-dimensional arrays, (arrays of arrays). I have found the gcc flag -funroll-all-loops . If I understand correctly, this will unroll all loops automatically without any efforts by the programmer. My questions: a) Does gcc include this kind of optimization with the various optimization flags as -O1 , -O2 etc.? b) Do I have to use any pragma s inside my code to take

Does gcc 4.8.1 enable sse by default?

强颜欢笑 提交于 2019-12-03 04:25:14
问题 I experienced crashes running an old code of mine on a system which doesn't support SSE4.1, I debugged a bit and found SSE instructions in the glibc, is that possible? Why isn't this reported in gcc 4.8.1 release notes? 回答1: You can see what optimizations are used by GCC with the following command: $ gcc -Q --help=target For instance, on my machine, GCC does not enable sse4.1 by default: $ gcc -Q --help=target | grep msse4.1 -msse4.1 [disabled] However, it is supported because it appears in

Is GCC loop unrolling flag really effective?

感情迁移 提交于 2019-12-02 19:23:28
In C, I have a task where I must do multiplication, inversion, trasposition, addition etc. etc. with huge matrices allocated as 2-dimensional arrays, (arrays of arrays). I have found the gcc flag -funroll-all-loops . If I understand correctly, this will unroll all loops automatically without any efforts by the programmer. My questions: a) Does gcc include this kind of optimization with the various optimization flags as -O1 , -O2 etc.? b) Do I have to use any pragma s inside my code to take advantage of loop unrolling or are loops identified automatically? c) Why is this option not enabled by

Does gcc 4.8.1 enable sse by default?

六眼飞鱼酱① 提交于 2019-12-02 17:39:26
I experienced crashes running an old code of mine on a system which doesn't support SSE4.1, I debugged a bit and found SSE instructions in the glibc, is that possible? Why isn't this reported in gcc 4.8.1 release notes? You can see what optimizations are used by GCC with the following command: $ gcc -Q --help=target For instance, on my machine, GCC does not enable sse4.1 by default: $ gcc -Q --help=target | grep msse4.1 -msse4.1 [disabled] However, it is supported because it appears in /proc/cpuinfo . And indeed, if I ask GCC to optimize the generated code for my machine, it enables sse4.1: $

error: no match for 'operator<<' using boost::serialisation

落爺英雄遲暮 提交于 2019-12-02 06:12:45
问题 I am trying to get some (hitherto) windows code to compile on a unix machine but am getting some errors at the following method: namespace EDIN { void World::Save(char const filename[]) { std::ofstream ofs(filename); boost::archive::text_oarchive oa(ofs); oa << this << cellSequence << report; // line 590: error! } } The error looks like this: test.cpp: In member function ‘void EDIN::World::Save(const char*)’: test.cpp:122:12: error: no match for ‘operator<<’ (operand types are ‘boost::archive

error: no match for 'operator<<' using boost::serialisation

丶灬走出姿态 提交于 2019-12-02 01:28:41
I am trying to get some (hitherto) windows code to compile on a unix machine but am getting some errors at the following method: namespace EDIN { void World::Save(char const filename[]) { std::ofstream ofs(filename); boost::archive::text_oarchive oa(ofs); oa << this << cellSequence << report; // line 590: error! } } The error looks like this: test.cpp: In member function ‘void EDIN::World::Save(const char*)’: test.cpp:122:12: error: no match for ‘operator<<’ (operand types are ‘boost::archive::text_oarchive’ and ‘EDIN::World*’) oa << this << cellSequence << report; // line 590: error! ^ test

QT Creator adds -Xarch

删除回忆录丶 提交于 2019-12-01 19:21:34
问题 I was using the QT Creator with an old GCC, now i updated to the 4.8 version. But the QT Creator adds a -Xarch_x86_64 option, the GCC 4.8 tells me g++: error: unrecognized command line option '-Xarch_x86_64' Is there a way to remove this options? I tried to use CONFIG -= x86_64 ppc64 x86 ppc 64 arch_x86_64 -arch -Xarch_x86_64 QMAKE_CXXFLAGS += -std=c++11 -v QMAKE_CXXFLAGS += -std=c++0x QMAKE_CXXFLAGS -= x86_64 ppc64 x86 ppc 64 arch_x86_64 -arch -Xarch_x86_64 QMAKE_CXXFLAGS += -mmacosx-version

Call function inside a lambda passed to a thread

风格不统一 提交于 2019-12-01 13:18:09
I'm trying to create a object that can be given a function and its parameters to his constructor. This class will then call the given function inside a lambda that is instead passed to a thread. Something along the lines of class worker { public: template <class Fn, class... Args> explicit worker(Fn f, Args ... args) { t = std::thread([&]() -> void { f(args...); }); } private: std::thread t; }; int main() { worker t([]() -> void { for (size_t i = 0; i < 100; i++) std::cout << i << std::endl; }); return 0; } But I get the following error error: parameter packs not expanded with '...': f(args...

GCC doesn't make use of inc

隐身守侯 提交于 2019-12-01 04:46:11
The GCC compiler $ gcc --version gcc (GCC) 4.8.2 ... doesn't generate an inc assembly instruction, where it could actually be useful, like in this C program: int main(int argc, char **argv) { int sum = 0; int i; for(i = 0; i < 1000000000L; i++) <---- that "i++" sum += i; return sum; } Instead, it generates an add instruction: 0000000000000000 <main>: 0: 31 d2 xor %edx,%edx 2: 31 c0 xor %eax,%eax 4: 0f 1f 40 00 nopl 0x0(%rax) 8: 01 d0 add %edx,%eax a: 83 c2 01 add $0x1,%edx <---- HERE d: 81 fa 00 ca 9a 3b cmp $0x3b9aca00,%edx 13: 75 f3 jne 8 <main+0x8> 15: f3 c3 repz retq Why does it do this?