c++

Speed Up linking speed / Fast linking on linux.

Hi, I am building webkit ( 2 Million lines ) after every ten minutes to see the output of my change in it, and linking of webkit on my Machine requires to process 600-700 MB of object files which are there on my hard-disk. That takes around 1.5 minutes. I want to speedup this linking process. Is there any chance that, I can tell os to ...

C++: compilation error - "no .eh_frame_hdr table will be created"

I'm supposed to use a data analysis program for a physics experiment. I can't get it to compile though. The code is old, not really compatible with current GCC-versions from what I can find. To make things a bit more time-comsuming, I got the code from a guy who had modified all the makefiles to make it compile on Mac. I have no C++-exp...

Namespace in definition and implementation

If one has a header file, let's say "test.h" including namespace test { enum ids { a = 1, b = 2, c = 3, d = 30 }; char *names[50]; }; and a source file, "test.cc" basically only including test::names[test::a] = "yum yum"; test::names[test::c] = "pum pum"; // ... Wouldn't it make more sense to wr...

Is it possible to create a thread that doesn't exit even when main thread exits in windows using c/c++?

Like in the above graph,all other threads will automatically exit once the main thread is dead. Is it possible to create a thread that never dies? ...

function vs variable declaration in C++

This code works: std::ifstream f(mapFilename.c_str()); std::string s = std::string(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>()); ParseGameState(s); Whereby mapFilename is an std::string and void ParseGameState(const std::string&);. And this does not: std::ifstream f(mapFilename.c_str()); std::string s(std::is...

problems parsing a microsoft compound document [SOLVED]

EDIT: (secid + 1) * 512 should be (secid + 1) * sec_size hi. having a bit of a struggle wrestling with the compound document format. I'm working in C at the moment but i am having problems with locating the directory sector. I can obtain the compound doc header which is trivial and i know the formula for finding a file offset of a sect...

Parsing INI-like configuration files.

I'm writing an INI-like configuration file and I want to know the best way to parse it in C/C++. I'm writing it on POSIX, so I'll be using # instead of ;. Which doesn't matter. I just want to know, is there some kind of tutorial, article on parsing things or something. ...

Invoking a boost::function through boost::function_base

I have an unordered_map of functions that should be called on an object when an XML file is parsed. I have found that boost::function has a base class named boost::function_base, however as expected I cannot invoke it because I don't have the signuture of the function. Since all of those functions are setter functions, I can guarantee th...

Declaring a huge dynamic array with tiny cells [C++]

Hello, I have this project I'm working on. The following conditions apply In this project I need to create one huge array (hopefully I will be able to create one as big as ~7.13e+17, but this target is still up ahead.) Each cell inside the array can contain one of the three values: 0,1,2 I'm using C++ as my language. I tried using th...

GLU Tesselator says: "Need combine callback" But I defined a callback...

Hi, I registered a CALLBACK using: gluTessCallback(tess, GLU_TESS_COMBINE, (GLvoid(*)()) &scbCombine); Where scbCombine is a function directly in the same .cpp file: void CALLBACK scbCombine(const double newVertex[3], const double *neighborVertex[4], const float neighborWeight[4], double **outData) { instanceMDC->cbCombine(newVe...

How to get my IHttpNegotiate implementation called by IWebBrowser??

Hi! I use cwebpage_src code and I need to update some HTTP request headers while clicking on links. As I understand it can be done with self implementation of IHttpNegotiate->BeginTransaction. But how to get my IHttpNegotiate implementation called?? Thanks! ...

SWIG - Problem with namespaces

I'm having trouble getting the following simple example to work with SWIG 1.3.40 (and I also tried 1.3.31). The Foo structure comes through as a Python module as long as I don't wrap it in a namespace, but as soon as I do I get a compilation error in the generated test_wrap.c. test.h: #ifndef __TEST_H__ #define __TEST_H__ #define USE...

C++ OOP basics (assigning an object as a member)

Hi, I'm a PHP developer trying to write some C++. I'm having trouble with assigning an object as an another object's property. In PHP, I'd write this: class A { public $b; } class B { } $a = new A; $a->b = new B; How do I do that in C++? I got this so far: class A { B b; public: void setB(&B); }; class B { }; void A:...

Can one access the template parameter outside of a template without a typedef?

A simple example: template<typename _X> // this template parameter should be usable outside! struct Small { typedef _X X; // this is tedious! X foo; }; template<typename SomeSmall> struct Big { typedef typename SomeSmall::X X; // want to use X here! SomeSmall bar; X toe; }; Is there a way to access the template paramet...

How can the allowed range of an integer be restricted with compile time errors?

I would like to create a type that is an integer value, but with a restricted range. Attempting to create an instance of this type with a value outside the allowable range should cause a compile time error. I have found examples that allow compile time errors to be triggered when an enumeration value outside those specified is used, but...

C++ Why won't my sample program create the output file?

I'm writing a small/beta testing program that will be put to use in my much bigger program for a project. It requests the user for an input file name (IE data.txt) and creates an output file named filename.out (IE data.out). I've tried a simple outFile << "text here"; to try it out but it doesn't create output file. I'm sure I'm messing...

OpenGL Smooth Polygon

I am trying to make this a smooth polygon using OpenGL, but it is not doing anything. Can someone please explain what I am doing wrong? glColor4ub(r, g, b, a); glEnable(GL_POLYGON_SMOOTH); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); glBegin(GL_QUADS); glVertex2i(x, y); glVertex2i(x1, y1); glVertex2i(x2, y2); ...

Platform-independent detection of arrow key press in C++

In a C++ console program, I've found how to detect and arrow key on Windows, and I've found a lot of other stuff that had nothing to do with the question (despite what I thought were good search terms), but I want to know if there is a platform-independent way to detect an arrow key press. A decent second place for this would be how to ...

Split an image into 64x64 chunks

Hi all, I'm just wondering how I would go about splitting a pixel array (R,G,B,A,R,G,B,A,R,G,B,A,etc.) into 64x64 chunks. I've tried several methods myself but they all seem really over-complex and a bit too messy. I have the following variables (obviously filled with information): int nWidth, nHeight; unsigned char *pImage; And bas...

Getting Zune information into Trillian

So I've been trying to get this to work for a long time, but I don't really know the Trillian API and need some help. I can do it three different ways: Get song info from registry (using http://znp.codeplex.com/) Read information from a fake Winamp window (http://tinyurl.com/znpdig) Act as WLM to recieve the messages Zune sends The ...