Questions tagged [gcc4.7]

Version 4.7 of GCC (GNU Compiler Collection). GCC is the de facto standard C compiler on Linux (though version 4.7 is not used by modern versions of Linux). The compiler collection supports many other languages and platforms as well.

Version 4.7.0 was released on 2012-03-22. Version 4.7.4 was released on 2014-06-12.

See also:

136 questions
32
votes
1 answer

Lambda not found when defined in an inline function in G++ 4.7

I have the following function defined in a header file (the library it is part of aims at being header-only): typedef bool (*FieldComparer)(const std::string&, const std::string&); inline FieldComparer GetComparer(const std::string& query, string&…
J.N.
  • 8,203
  • 3
  • 29
  • 39
24
votes
3 answers

c++: copy by value to function params produce two objects in vs2012

Here's code that produces different output in g++ 4.7 and vs2012 (cl17). #include using namespace std; class A { public: A() { cout << "1" << endl; } ~A() { cout << "2" << endl; } }; class B : public A { public: B() { cout…
user1823018
  • 211
  • 1
  • 3
23
votes
1 answer

What is the default for gcc -march option?

The gcc info file says in the section on x86-64 specific flags, among other things: There is no `-march=generic' option because `-march' indicates the instruction set the compiler can use, and there is no generic instruction set applicable to all…
BehemothTheCat
  • 305
  • 3
  • 7
23
votes
2 answers

map::emplace() with a custom value type

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 using namespace std; class Foo { // private…
Nicu Stiurca
  • 8,747
  • 8
  • 40
  • 48
20
votes
2 answers

How to disable narrowing conversion warnings?

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…
klm123
  • 12,105
  • 14
  • 57
  • 95
16
votes
1 answer

GCC bug or UB? Should this code compile?

The code below compiles fine with clang, but does not compile with GCC (tried 4.1.2, 4.5.4 and 4.7.2): template struct A { struct B { }; }; template bool operator==(typename A::B const& b, T const& t); enum { BAR…
iv_
  • 161
  • 3
14
votes
1 answer

(Optimization?) Bug regarding GCC std::thread

While testing some functionality with std::thread, a friend encountered a problem with GCC and we thought it's worth asking if this is a GCC bug or perhaps there's something wrong with this code (the code prints (for example) "7 8 9 10 1 2 3", but…
iamOgunyinka
  • 1,040
  • 1
  • 9
  • 17
13
votes
9 answers

Using unique_ptr to control a file descriptor

In theory, I should be able to use a custom pointer type and deleter in order to have unique_ptr manage an object that is not a pointer. I tried the following code: #ifndef UNIQUE_FD_H #define UNIQUE_FD_H #include #include…
Shachar Shemesh
  • 8,193
  • 6
  • 25
  • 57
13
votes
4 answers

gcc c++11 limits for user defined constants and template parameter packs

I've been playing with user defined constants in gcc 4.7.2 and ran into some sort of size limiting factors which I do not quite understand. The idea was to define a constexpr operator "" for fixed point decimal type. I want to avoid casting from…
Вова
  • 309
  • 2
  • 8
13
votes
2 answers

difference_type not found

When I try to use std::distance with a custom iterator under gcc 4.7, it complains about not finding the difference_type. I have sadly no idea why it fails. #include class nit { public: typedef int difference_type; }; int main() { …
abergmeier
  • 13,224
  • 13
  • 64
  • 120
13
votes
1 answer

g++ 4.7 evaluates operator "" as sibling to macro expansion

I'm moving some code over to GCC 4.7 (from 4.6) and ran into a few compiler errors and found the problem documented in the GCC 4.7 porting guide: User-defined literals and whitespace The C++ compiler in ISO C11 mode…
Travis Gockel
  • 26,877
  • 14
  • 89
  • 116
11
votes
2 answers

Linker error using GCC, incl. for binutils and textinfo

I am getting this error every time, while compiling programs, configuring and installing some things like binutils, textinfo, etc.: /usr/local/bin/ld: this linker was not configured to use sysroots collect2: error: ld returned 1 exit status When…
Reddi Rajendra P
  • 704
  • 9
  • 25
11
votes
5 answers

Linker error: undefined reference to symbol 'pthread_rwlock_trywrlock@@GLIBC_2.2.5'

I've been developing with CentOS, Qt 4.7, and GCC 4.4 I've just installed Red Hat Developer Toolset 1.1 which includes GCC 4.7.2, and at the end of make, I get an error /usr/bin/ld: ../../bin/Solo: undefined reference to symbol…
segfault
  • 5,759
  • 9
  • 45
  • 66
11
votes
1 answer

What's the difference between thread_posixs and thread_win32 in gcc port of Windows?

I wanted to download the latest available version of gcc 4.7.2 compiler for Windows. When I got to this page where I was supposed to see a download link, I confronted with two categories: threads-posix threads-win32 What's the difference between…
Hossein
  • 24,202
  • 35
  • 119
  • 224
10
votes
1 answer

C++ freestanding features

What are the features that I can use in c++ freestanding environment? I am developing a little kernel (for my own pleasure) and I know that I can't use the whole stdlib library, but what else ? when I tried to use the new and delete operators it…
Adrien
  • 439
  • 4
  • 15
1
2 3
9 10