g++

[SOLVED] How do I find out why g++ takes a very long time on a particular file?

I am building a lot of auto-generated code, including one particularly large file (~15K lines), using a mingw32 cross compiler on linux. Most files are extremely quick, but this one large file takes an unexpectedly long time (~15 minutes) to compile. I have tried manipulating various optimization flags to see if they had any effect, wi...

Can I ungarble GCC's RTTI names?

On my Ubuntu computer, when I ask for an object/variable's type using typeid, I get a weird-looking name using the type_info::name method. (By "weird" I mean that it's different from what I'd expect to get on Windows.) I Googled around a bit, and found out that RTTI names are implementation-specific. Problem is, I want to get a type's n...

Linking using g++ fails searching for -lstdc++

I'm trying to use someone else's Makefile to complile a very simple c++ library. The makefile is as follows: JNIFLAGS=-O2 -pthread -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux all: rm -f ../dist/libUtils.so g++ $(JNIFLAGS) -c -m32 -o com_markets_utils_dates_NativeTime.o com_markets_utils_dates_Nativ...

queue from the stl

I am trying to get the following code to compile using g++ 4.2.1 and am receiving the following errors CODE: #include <iostream> #include <queue> using namespace std; int main (int argc, char * const argv[]) { queue<int> myqueue(); for(int i = 0; i < 10; i++) myqueue.push(i); cout << myqueue.size(); retu...

Increase stack size with XCode

I developed a command line application on Linux which needs its stack to be increased. On Linux I just used the workaround: ulimit -s unlimited before running the program. On Mac OS X, command line with G++, I add to the compilation options: -Wl,-stack_size,0x10000000 and it works. Now I am developing this program with XCODE, where s...

Compile C++ code to run on ESXi 3.5

I'm trying to compile a simple c++ program to run inside ESXi 3.5 console window. It seems I'm linking with wrong libraries... Is there a setup described somewhere - which version of G++ and libraries do I have to be using in order to do so? ...

Concatenating strings in C++

Hi, I am rather inexperienced C++ programmer, so this question is probably rather basic. I am trying to get the file name for my copula: string MonteCarloBasketDistribution::fileName(char c) { char result[100]; sprintf(result, "%c_%s(%s, %s).csv", copula.toString().c_str(), left.toString().c_str(), right.toString().c_str()); ...

Include paths not found while compiling with g++ on MacOS

I'm trying to compile the simplest program on MacOS 10.6 like: $ g++ -o hello hello.cpp the following source: #include <iostream> int main (int argc, char * const argv[]) { std::cout << "Hello, World!\n"; return 0; } I'm getting the error: hello.cpp:1:20: error: iostream: No such file or directory hello.cpp: In function ‘...

How do I install g++ on MacOS X?

I want to compile C++ code on MacOS X, using the g++ compiler. How do I install it? ...

Dump class/struct member variables in g++

Is there a flag in g++ or tools to dump the member variables of a struct/class? To illustrate, consider source code like this struct A { virtual void m() {}; }; struct B : public A { int b; virtual void n() = 0; }; struct C : public B { int c1, c2; void o(); }; struct D : public C { virtual void n() {}; A d; }; I want to get something...

Segmentation fault

Hi, This is probably a silly question, but I can't see what I am doing wrong here. I have the class: #include <sys/time.h> #include <gsl/gsl_cdf.h> #include <gsl/gsl_randist.h> #include <cmath> #include "randomnumbergenerator.h" class RandomNumberGenerator { gsl_rng * rn; public: RandomNumberGenerator(); ~RandomNumberGener...

Does gcc, icc, or Microsoft's C/C++ compiler support or know anything about NUMA?

If I have a multi-processor board that has cache-coherent non-uniform memory access ( NUMA ), i.e. separate "northbridges" with separate RAM for each processor, does any compiler know how to automatically spread the data across the different memory systems such that processes working on local threads are mostly retrieving their data from...

g++ compiler: optimization flag adds warning message

I noticed this interesting behaviour of the g++ compiler, if I add a -O3 flag to the compiler, I get otsu.cpp:220: warning: ‘x’ may be used uninitialized in this function However, when I do not use optimization and instead use a debug flag -g I got no warnings at all. Now, I trust the compiler more when the -g flag is on; however, I'm...

gcc and g++ not provided by the webhosing machine

All, In a webserver if gcc and g++ are not provided by the hosting service to the user.Can we download it and compile through it in RHEL5 OS. If so please provide the suitable link to download it. Thanks...... ...

g++ does it make sense to add optimization flag when compiling static library

Or does it just make more sense to leave the optimization until you use the library, or is it when you link the library you are already past the point where the compiler can optimize the library? ...

what is the error in my program??

Hello, I am trying to intercept libpthred( POSIX ) function calls using LD_PRELOAD technique. First I tried to create my own shared library having the same functin names as in the pthread library. Here is an example of my own created pthread_create function which first gets the address of original pthread_create function in the pthread l...

gcc with parameters "-S -save-temps" puts intermediate files in current directory

The parameters -S -save-temps work fine, as long as i don't use them on files with the same name. Think of the following situation: I have a project with a main directory and a subdirectory with the name subDir and in both of the directories are files placed with the name file.c. If I now call gcc -S -save-temps file.cpp subDir/file.c o...

G++ and sed pipeline

Hello, I would like to replace all "no" by "on" in the console output of g++. I tried $ g++ | sed -e 's/no/on/g' But it shows i686-apple-darwin9-g++-4.0.1: no input files instead of i686-apple-darwin9-g++-4.0.1: on input files ...

Error while compiling simple code in boost. How to find the name of the library ?

http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/example/allocation/server.cpp g++ -L./lib/boost_1_41_0/ -L./lib/soci-3.0.0/ -L/usr/lib/ -L/usr/local/lib/ -L./ -I/usr/include -I./lib/boost_1_41_0 -o main server.o -lssl -pthread server.o: In function `error_code': /test/mycode/./lib/boost_1_41_0/boost/system/error_code...

gcc -print-prog-name=??? doesn't work as I would expect

if I understand the gcc manuals right than the option -print-prog-name should print the name of the program used. But it seems that this option only echoes the given argument Examples: gcc -print-prog-name=ld --> ld gcc -print-prog-name=xxxsome-funny-name --> xxxsome-funny-name Is this the expected behaviour? I think it should prin...