g++

Install gcc on linux with no root privilege

I have access to computer in a public library and I want to try out some C++ and maybe other code. Problem is that there is no g++ installed and I can't install it using packages because I have no root access. Is there a "smart" way to make a full environment for programming in a home folder? I have gcc installed (I can compile C code)....

g++ __FUNCTION__ replace time

Hi, can anyone tell when g++ replaces the __FUNCTION__ 'macro' with the string containing the function name? It seems it can replace it not until it has check the syntactical correctness of the source code, i.e. the following will not work #include <whatsneeded> #define DBG_WHEREAMI __FUNCTION__ __FILE__ __LINE__ int main(int argc, ch...

my program skips over a return statement

My program has this function: vector<itemPtr> Level::getItemsAt(const Point& pt) { vector<itemPtr> vect(items.size()); // copy all items at pt's position to vect remove_copy_if(items.begin(), items.end(), vect.begin(), boost::bind(matchesPosition<itemPtr>, _1, pt)); // upda...

How to instruct GCC to stop after 5 errors?

Is it possible to instruct GNU c++ compiler to stop after 5 errors found? Can't find this in documentation. Thanks in advance. ...

Erroneous private base class inaccessible?

Compiling this code using g++ 4.2.1: struct S { }; template<typename T> struct ST { }; template<typename BaseType> class ref_count : private BaseType { }; template<typename RefCountType> class rep_base : public RefCountType { }; class wrap_rep : public rep_base<ref_count<S> > { typedef rep_base<ref_count<S> > base_type; // lin...

Is there a (Linux) g++ equivalent to the /fp:precise and /fp:fast flags used in Visual Studio?

Background: Many years ago, I inherited a codebase that was using the Visual Studio (VC++) flag '/fp:fast' to produce faster code in a particular calculation-heavy library. Unfortunately, '/fp:fast' produced results that were slightly different to the same library under a different compiler (Borland C++). As we needed to produce exactly...

How to get all duplicate symbol linker errors at once?

Hi, I am building a C++ project in XCode which uses two libraries. Say for e.g libX.a and libY.a. There are some function definitions common on libX.a and libY.a for which I get duplicate symbol linker error. This is fine, but I get only one error at a time. Once I fix the error, I'll get the next duplicate symbol error and this proces...

Find out which functions were inlined

When compiling C++ with GCC 4.4 or MSVC is it possible to get the compiler to emit messages when a function is inlined? ...

C++ get the mangled names of a function/method

Hi I need to determine the mangled name of a function from within an c++ app itself. Is there any equivalent to the __FUNCDNAME__ macro in g++ ? ...

codeSourcery G++ Lite Edition is a freeware?

hi, codeSourcery G++ Lite Edition is a freeware or Sharware? any help please? please see the link "http://www.codesourcery.com/sgpp/lite_edition.html" ...

Does std::vector use the assignment operator of its value type to push_back elements?

If so, why? Why doesn't it use the copy constructor of the value type? I get the following error: /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/vector.tcc: In member functio n `ClassWithoutAss& ClassWithoutAss::operator=(const ClassWithoutAss&)': /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/vector.tcc:238: instantiate d f...

Xcode: setting to enable C++ even when no C++ sources are in the project?

I have an Objective-C/Cocoa project that incorporates a static library. That static library has some object files that have C++ in them. I've found that if the project that I'm using the library in contains no other C++ in it, the link fails (can't link new/delete/etc). But simply adding a single (empty) .cpp file to the project causes...

push_back of unique_ptr

What's wrong here? #include <memory> #include <vector> int main() { std::vector<std::unique_ptr<int>> vec; int x(1); std::unique_ptr<int> ptr2x(&x); vec.push_back(ptr2x); //This tiny command has a vicious error. return 0; } The error: $ g++ -std=gnu++0x main.cpp In file included from c:\mingw\bin\../lib/gcc/min...

My C++ code runs perfectly on MS C++ compiler but gives me NaN on g++ compiler. Why?

I'm simulating a biological model involving several (27) stiff ordinary differential equations using C++. My program runs perfectly under MS C++ 2010 expression compiler but fails under the g++ compiler (NetBeans 6.8, Ubuntu 10.04 LTS). The problem is that some of the variables become NaN. The following are the values of the variable Vm ...

Speedup GNU make build process - Parallelism?

I build a huge project frequently and this takes long time (more than one hour) to finish even after configuring pre-compiled headers. Are their any guidelines or tricks to allow make work in parallel (e.g. starting gcc in background, ...etc) to allow for faster builds? Note: Sources and binaries are too large in size to be placed in a ...

Calling a C++ macro with fewer arguments

Hi, is it possible to call function-like-macros with less that all the parameters in linux? actually doing this only generates a warning in Visual Studio (warning 4003) and unassigned variables replaces with "". But compiling it using g++ generates an error in linux ("error: macro * requires ** arguments, but only ** given"). is there...

Performance difference between gcc and g++ for C program

Lets say i have written a program in C and compiled it with both gcc and g++, which compilation will run faster? gcc or g++? I think g++ compilation will make it slow, but not sure about it. Let me clarify my question again because of confutation about gcc. Let say i compile program a.c like this on console. gcc a.c g++ a.c which a...

Will Brew MP Run without Sourcery G++ ARM Compiler?

can I compile & run Brew MP Applications without Sourcery G++ ARM Compiler? ...

g++ duplicate symbol error when working with templates (noob question)

Hi, So I'm trying to pick C++, and to do so I decided to write a generic Group class using templates, that takes a Type and size as template parameters: in group.h: #ifndef __GROUP_H #define __GROUP_H #define MAX_SIZE 10 /********************************************************** * Define a Group class that handles a collection of m...

g++ 4.4 "error while loading shared libraries"

I'm following the C++ Cookbook tutorial on static and dynamic library linking with g++. I can build the binary fine, but when I run it I get the error ./hellobeatles: error while loading shared libraries: libjohnpaul.so: cannot open shared object file: No such file or directory I used the command : g++ -o hellobeatles hellobeatles.cpp...