gcc4.7

How to use isnan as a predicate function to std::find_if (c++11)

孤街醉人 提交于 2019-12-12 13:57:49
问题 I have a piece of code that is operating on a std::vector<double> cats and is doing something like this: std::find_if(cats.begin(), cats.end(), std::isnan<double>); this compiles under gcc before 4.3 but no longer compiles with gcc 4.7.2. I get an error like this: error: no matching function for call to 'find_if(std::vector<double>::iterator, std::vector<double::iterator, <unresolved overloaded function type>)' How can I get this to compile under newer gcc? And preferably also under the older

Clang 3.2 build broken after building gcc 4.7

旧时模样 提交于 2019-12-12 09:48:16
问题 So I know Clang depends (most of the time) on Gnu's libstdc++3, but after building gcc 4.7.0 (cuz' of awesome!) I seem to have run into a problem, all the paths for clang are wrong. Do I need to clean my build directory and start from scratch for clang, specifically it gives me the error bits/c++config.h missing, although it is there and builds just fine with gcc I am on Linux x86, Ubuntu 12.04 回答1: Yes, the paths for GCC's headers and libs include the version, 4.7.0 in your case, so you'll

linking error: undefined reference to icu_50::UnicodeString::UnicodeString()

谁说胖子不能爱 提交于 2019-12-10 17:16:41
问题 I am trying to compile my project where I've declared as class members some: icu::UnicodeString label; icu::UnicodeString tags; icu::UnicodeString domain; icu::UnicodeString data; After having included (yes it is found) #include <unicode/unistr.h> In my CMakeLists.txt it searches, finds and links with: icuuc icudata (libicuuc, libicudata) as the output suggests prior to throwing the errors: -o icarus -rdynamic -lPocoNet -lPocoUtil -lPocoXML -licuuc -licudata I have built and installed from

How to disable narrowing conversion warnings?

时光毁灭记忆、已成空白 提交于 2019-12-10 12:10:56
问题 I use -Wall and updating to new gcc I have got a lot of warning: narrowing conversion . I want to disable them, but leave all other warnings untouched (ideally). I can find nothing about narrowing in http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html How to disable narrowing conversion warnings? Is it possible at all? P.S. I need to Disable warnings, not fix them in the source code. Blind -Wno-conversion doesn't help. 回答1: As gx_ said, adding -Wno-narrowing to your command line should

map::emplace() with a custom value type

旧巷老猫 提交于 2019-12-09 07:53:58
问题 I'm having trouble using map::emplace() . Can anyone help me figure out the right syntax to use? I am effectively trying to do the same thing as in this example. Here is my version: #include <map> using namespace std; class Foo { // private members public: Foo(int, char, char) /* :init(), members() */ { } // no default ctor, copy ctor, move ctor, or assignment Foo() = delete; Foo(const Foo&) = delete; Foo(Foo &&) = delete; Foo & operator=(const Foo &) = delete; Foo & operator=(Foo &&) =

More efficient assembly code?

一世执手 提交于 2019-12-08 07:26:20
问题 I've recently began studying assembly. Just wondering why this assembly is written the way it is instead of the alternative "My Assembly" I list below. It cuts out one instruction. Any ideas? Is it too rare of a case where this works? Just seems wasteful to me to move the value of 3 to eax first. C code: #include<stdio.h> int main() { int a = 1; int b = 3; a = a+b; return a; } Assembly: Dump of assembler code for function main: 0x080483dc <+0>: push ebp 0x080483dd <+1>: mov ebp,esp 0x080483df

More efficient assembly code?

≯℡__Kan透↙ 提交于 2019-12-07 23:38:28
I've recently began studying assembly. Just wondering why this assembly is written the way it is instead of the alternative "My Assembly" I list below. It cuts out one instruction. Any ideas? Is it too rare of a case where this works? Just seems wasteful to me to move the value of 3 to eax first. C code: #include<stdio.h> int main() { int a = 1; int b = 3; a = a+b; return a; } Assembly: Dump of assembler code for function main: 0x080483dc <+0>: push ebp 0x080483dd <+1>: mov ebp,esp 0x080483df <+3>: sub esp,0x10 0x080483e2 <+6>: mov DWORD PTR [ebp-0x4],0x1 0x080483e9 <+13>: mov DWORD PTR [ebp

const QList<int> warnings = QList<int>() << 0; segfaults with gcc 4.7.2

梦想的初衷 提交于 2019-12-07 10:23:13
问题 So the code mentioned on the topic line causes segmentation fault with Qt 4.8.3 & gcc 4.7.2 This is at outside of any classes/structs at .cpp-file and works with gcc 4.4 const QList<int> warnings = QList<int>() << 0 << 3 << 7; Traces gives these two hints: __do_global_ctors() __static_initialization_and_destruction_0 So it seems that "warning" is not yet available when its inserting latter list into it. Works with 4.7.2 if i change it into this: global scope: QList< int> warnings; This is

GCC-4.7 Compilation error

大憨熊 提交于 2019-12-07 04:49:59
问题 When I add the last line from this snippet to my program code: typedef std::set<Job> JobSet; typedef boost::shared_ptr<JobSet> JobSetPtr; JobSetPtr jobs_; jobs_->insert ( job ); // line 60 I get this error: g++-4.7 -o /home/kron/Software/Synchronizer/1.0/Main.o -c src/Main.cpp In file included from /usr/include/c++/4.7/string:50:0, from /usr/include/c++/4.7/bits/locale_classes.h:42, from /usr/include/c++/4.7/bits/ios_base.h:43, from /usr/include/c++/4.7/ios:43, from /usr/include/c++/4.7

const QList<int> warnings = QList<int>() << 0; segfaults with gcc 4.7.2

≡放荡痞女 提交于 2019-12-05 13:57:32
So the code mentioned on the topic line causes segmentation fault with Qt 4.8.3 & gcc 4.7.2 This is at outside of any classes/structs at .cpp-file and works with gcc 4.4 const QList<int> warnings = QList<int>() << 0 << 3 << 7; Traces gives these two hints: __do_global_ctors() __static_initialization_and_destruction_0 So it seems that "warning" is not yet available when its inserting latter list into it. Works with 4.7.2 if i change it into this: global scope: QList< int> warnings; This is inisde some function: warnings = QList<int>() << 0 << 3; I'm wondering why this happens? Edit: I guess i