g++

LD: linking with STL libraries

Hello. I was trying to compile a OpenCV's VideoCapture example. When I compile it, I get the following output: gpp test.c Info: resolving vtable for cv::VideoCapture by linking to __imp___ZTVN2cv12VideoCaptureE (auto-import) c:/programs/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: warning: auto-importing has enable...

How to compile c++ using mingw from an apache cgi?

Hi ! I'm trying to execute mingw's g++ from inside a cgi written for apache. The line I execute is: c:\mingw\bin\g++.exe -Wall -IC:\hpxbase -O2 -c -v -o code.o code.cpp This works when I call exactly this line from a cmd window. But when run from my cgi, g++ crashes. I made the cgi open up ots own console window and there is the messa...

Cygwin boost comes with new g++ which seems to break my code... why?

Setup: I installed Cygwin with the GNU programming lineup (gcc, g++, make, and gdb) and successfully compiled an ran a program that I was working on. Then I decided to install boost into Cygwin because I will need to use typical boost stuff as my program develops. So, using the Cywing setup.exe, I installed boost. After this, the pro...

oprofile unable to produce callgraph on ARM

This is actually an exact duplicate of this SO question which unfortunately does not have any answer. Is it possible to get a proper callgraph on ARM? I'm using oprofile 0.9.6 on an ARM926 which does not have performance counters so oprofile defaults to using the timer interrupt, I've set the --callgraph option and my app is compiled wit...

oprofile on Linux running in a virtual machine

I'm running a Linux Ubuntu 10.4 VM using VirtualBox. I'm trying to use oprofile to profile some application in the virtual machine. I've installed oprofile 0.9.6 but I cannot get it to work. When I try to start I get the following error: opcontrol --start /usr/local/bin/opcontrol: line 323: /usr/local/bin/ophelp: cannot execute binary f...

Explain Change to GNU C++ filebuf::underflow() interacting with filebuf::seekoff()

My company's products run on a number of qualified Linux hardware/software configurations. Historically, the compiler used has been GNU C++. For purposes of this post, let's consider version 3.2.3 the baseline, as our software 'worked as expected' through that version. With the introduction of a newer qualified platform, using GNU C++ v...

C++ FileIO Copy -VS- System("cp file1.x file2.x)

Would it be quicker/efficient to write a file copy routine or should I just execute a System call to cp? (The file system could differ [nfs, local, reiser, etc], however it would always be on a CentOS linux system) ...

Using c99 in C++'s `extern "C"` blocks

I would like to have a function written in C, but callable from C++ which takes a restricted pointer. This is only available in c99, so g++ doesn't like it, even in extern "C" blocks. How can I get around this limitation? ...

How to know if make is using gcc or g++

If I run make then how can I tell if gcc or g++ is being used? I tried to look at the Makefile but didn't find anything. Here is the output from make. I can't figure it out from this either. cd threads; make depend make[1]: Entering directory `/home/anthony/nachos-4.0/code/threads' g++ -I../lib -I../threads -I../machine -DTHREADS -Dx86...

Where to get iostream.h

I'm trying to make something in Linux, but it complains that it can't find iostream.h. What do I need to install to get this file? ...

g++ linker: force static linking if static library exists?

I've a program which links to many libraries. g++, by default, prefers to link to shared libraries , even if corresponding archive exists. How can I change this preference to prefer static archive over dynamic libraries , if a static archive exists. Note , I used '-static' option, but it tries to find static archive for all libraries whi...

Installing OpenCV on OSX 10.6 using MacPorts

Hi, I tried installing OpenCV following the instructions for a MacPorts install on http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port, typing sudo port install opencv in the terminal. The install/compilation seemed to go fine, and the files are in /opt/local subdirectories as they should be. As a first test, I then tried inclu...

g++ version compatibility

This is a specific gcc related question. I have a library compiled with g++ 4.1.2 that I want to give the user. The user can use our API in their code and link our library to create the final executable. The question I have is related to g++ version compatibility. Some of our users are using g++ 4.4.3, others 4.3.3, and still others 4.2...

sse inline assembly with g++

I'm trying out g++ inline assembly and sse and wrote a first program. It segfaults - why? #include <stdio.h> float s[128*4] __attribute__((aligned(16))); #define r0 3 #define r1 17 #define r2 110 #define rs0 "3" #define rs1 "17" #define rs2 "110" int main () { s[r0*4+0] = 2.0; s[r0*4+1] = 3.0; s[r0*4+2] = 4.0; s[r0*4+3] = 5.0; ...

char and initializer lists

I'd like to pass some numeric byte values via an initializer list a variadic template into an array. Is that possible? template < int N > struct a { char s[N]; template < typename ... A > a (A ... _a) : s {_a...} {} }; int main () { // g++-4.5: error: narrowing conversion of »_a#0« from »int« to »char« inside { } a < 3 > x { ...

Include static lib in dynamic lib

Hello all, I have the following problem : several object files a1.o, a2.o, a3.o, ... an archive libxxxx.a. The archive libxxxx.a only contains object files : b1.o, b2.o etc... I would like to create a shared library (.so) from all the object files. Problem : If I use : g++ -shared libxxxx.a a1.o a2.o ... -o libnew.so g++ does un...

What header file needs to be included for using nullptr in g++?

I am using g++ 4.4.1 and want to use nullptr, but I am not being able to find which header file is required to be included. It does not seem to be keyword either, because my attempt to use it is rejected as error: 'nullptr' was not declared in this scope ...

Template programming in C++

Hi, I am having trouble getting to grips with programming using templates in C++. Consider the following files. C.h #ifndef _C_H #define _C_H template <class T> class C { public: C(); virtual ~C(); } #endif _C_H C.cpp #include "C.h" template <class T> C<T>::C() { } template <class T> C<T>::~C() { } I try instantia...

Getting a negative NaN on g++ 4.4.3, is this standard?

I have g++ 4.4.3 on Linux with Ubuntu Lucid Lynx, and I am getting a: -nan as a result. On Hardy Heron with g++ 4.3.1, I am getting all nan This is causing my text diff regression to fail, since I am using cout to print this numerical result. What is the meaning of a signed nan, and is there a way to tell the compiler that an unsig...

Is it legal to declare a friendship with a forward declared class?

I have successfully constructed something similar to the following code in visual studio 2008: class OpDevconfigSession; class DevconfigSession { ... private friend class OpDevconfigSession; }; Again, this works quite well with visual studio. However, if I try to compile the code under g++ version 4.3.2, I get an error message su...