g++

not able to use g++ from Fedora

$ yum list | grep gcc arm-gp2x-linux-gcc.i686 4.1.2-11.fc12 @fedora arm-gp2x-linux-gcc-c++.i686 4.1.2-11.fc12 @fedora gcc.i686 4.4.3-4.fc12 @updates libgcc.i686 4.4.3-4.fc12 @updates ...

g++ on MacOSX doesn't work with -arch ppc64

I am trying to build a Universal binary on MacOSX with g++. However, it doesn't really work. I have tried with this simple dummy code: #include <iostream> using namespace std; int main() { cout << "Hello" << endl; } This works fine: % g++ test.cpp -arch i386 -arch ppc -arch x86_64 -o test % file test test: Mach-O universal binary...

Visual Studio 2008 awful performance

Hi, I have ported a piece of C++ code, that works out of core, from Linux(Ubuntu) to Windows(Vista) and I realized that it works about 50times slower on VS2008! I removed all the out of core parts and now I just have a piece of code that has nothing to do with the hard disk. I set compiler parameters to O2 in Project Properties but sti...

Are tr1 headers available for gcc v3.4.6?

Are tr1 headers available for g++ v3.4.6? If so, how can I locate them at compile time. The following is failing to compile: #include <tr1/memory> With the following error: myModule.h:20:24: tr1/memory: No such file or directory Do I need to move to a later compiler or do I have the headers somewhere? ...

C++ (g++) Compile Error, Expected "="/etc. Before 'MyWindow" (my class name)

Hi all, I have a very strange problem and the following code wont compile: #ifndef MYWINDOW_HPP_INCLUDED #define MYWINDOW_HPP_INCLUDED class MyWindow{ private: WNDCLASSEX window_class; HWND window_handle; HDC device_context_handle; HGLRC open_gl_render_context; MSG message; BOOL quit...

C++ Type error with Object versus Object reference

I have the following function (which worked in Visual Studio): bool Plane::contains(Vector& point){ return normalVector.dotProduct(point - position) < -doubleResolution; } When I compile it using g++ version 4.1.2 , I get the following error: Plane.cpp: In member function âvirtual bool Plane::contains(Vector&)â: Plane.cpp:36: er...

How to link festival TTS libraries in a C++ programme using g++

i am using Festival c++ Api but in the manual provided at http://www.cstr.ed.ac.uk/projects/festival/manual/festival_28.html#SEC132 saying to link festival/src/lib/libFestival.a etc. so please tell me hw to link them with my c++ programme ...

auto vectorization on double and ffast-math

Why is mandatory to use -ffast-math with g++ to achieve vectorization of loop using doubles? I don't like ffast-math because I don't want to loose precision. ...

g++ doesn't think I'm passing a reference

When I call a method that takes a reference, g++ complains that I'm not passing a reference. I thought that the caller didn't have to do anything different for PBR. Here's the offending code: //method definition void addVertexInfo(VertexInfo &vi){vertexInstances.push_back(vi);} //method call: sharedVertices[index]->addVertexInfo(Ver...

g++ How to get warning on ignoring function return value

lint produces some warning like: foo.c XXX Warning 534: Ignoring return value of function bar() From the lint manual 534 Ignoring return value of function 'Symbol' (compare with Location) A function that returns a value is called just for side effects as, for example, in a statement by itself or the left-hand side...

How can I use gtkmm with MinGW (g++) without MSYS?

Hello stackoverflow members, How can I use gtkmm with MinGW (g++) without MSYS? Here is the story of my problem: I installed MinGW offline with all required packages (full install). I installed Apache Server and I copied all .tar.gz files and I created a website called sourceforge.org [localhost] and I installed automatically MinGW on Wi...

Is typeid of type name always evaluated at compile time in c++ ?

I wanted to check that typeid is evaluated at compile time when used with a type name (ie typeid(int), typeid(std::string)...). To do so, I repeated in a loop the comparison of two typeid calls, and compiled it with optimizations enabled, in order to see if the compiler simplified the loop (by looking at the execution time which is 1us ...

Constant embedded for loop condition optimization in C++ with gcc

Will a compiler optimize tihs: bool someCondition = someVeryTimeConsumingTask(/* ... */); for (int i=0; i<HUGE_INNER_LOOP; ++i) { if (someCondition) doCondition(i); else bacon(i); } into: bool someCondition = someVeryTimeConsumingTask(/* ... */); if (someCondition) for (int i=0; i<HUGE_INNER_LOOP; ++i) ...

gcc 4.5 installation problem under ubuntu

I tried to install gcc 4.5 on ubuntu 10.04 but failed. Here is a compile error that I don't know how to solve. Is there anyone successfully install the latest gcc on ubuntu? Following is my steps and the error message, I'd like to know where is the problem.... Step1: download these files: gcc-core-4.5.0.tar.gz gcc-g++-4.5.0.tar.gz gmp-...

What do I need to include in my header file for ostream

When I try to compile my program the compiler complains about this line in a .h file that I #included. ostream & Print (ostream & stream); How can this be fixed? ...

writing structs and classes to disk

The following function writes a struct to a file. #define PAGESIZE sizeof(BTPAGE) #define HEADERSIZE 2L int btwrite(short rrn, BTPAGE *page_ptr) { long addr; addr = (long) rrn * (long) PAGESIZE + HEADERSIZE; lseek(btfd, addr, 0); return (write(btfd, page_ptr, PAGESIZE)); } The following is...

Why does this C++ char array seem to be able to hold more than its size?

#include <iostream> using namespace std; typedef struct { char streetName[5]; } RECORD; int main() { RECORD r; cin >> r.streetName; cout << r.streetName << endl; } When I run this program, if I enter in more than 5 characters, the output will show the whole string I entered. It does not truncate at 5 characters. Why...

How to copy a string into a char array in C++ without going over the buffer

I want to copy a string into a char array, and not overrun the buffer. So if I have a char array of size 5, then I want to copy a maximum of 5 bytes from a string into it. what's the code to do that? ...

array size for extendible hashing

If I want to use extendible hashing to store a maximum of 100 records, then what is the minimum array size that I need? I am guessing that an array of 100 would be sufficient, but I could be wrong. I also suspect that I can use a smaller array. ...

How to convert an int to a binary number to a string in C++

I have an int that I want to first convert to a binary number. Then I want to store that binary number in a string. How can this be done? ...