c++

How to use/link gdLibrary (libgd) with MS Visual C++ (e.g. 2008 Express Edition)? Getting LNK2019 errors...

Hi all, I have to use the gdLibrary (http://www.libgd.org) in a C++ App on MS Windows XP Prof. SP3 32bit - and I'm trying and googleing for two days now without success. Does anyone of you use libgd with MS VC++ 200x EE? My problem: It has to to compile with MS Visual C++ (e.g. the 2008 Express Edition - fixed 3rd party condition)... b...

Problem in luabind with default_converter and tables

===Edit=== The problem is actually much simpler than this, any wrapped function that takes a table is causing the problem. If I wrap a function that takes luabind::object, and call that function with a table argument, then the gc causes an invalid free(). I'm starting to think that this may be some kind of crazy compilation/linking pr...

Random Number Generation in C++

Possible Duplicate: Whats the Right Way to use the rand() Function in C++? Hi all, I'm trying to set up a random number generation function in c++. Im trying to set it up so that it generates a number between 1 & 500. Right now it returns integers in order according to the system clock, I need TRUE random numbers. Can anyone h...

Minimal AJAX server in C++

I would like to create a very bare-bones web server in C++ which only needs to respond to XMLHttpRequests. The idea to have an Apache server serving webpages which directs the XMLHttpRequests to an existing application so that the app can provide monitoring data to users. I have a hacky implementation working now where the existing app w...

In C++ when should someone make a private function virtual?

Possible Duplicate: Why would a virtual function be private? I've seen private virtal functions declared here and their in C++ but I'm not entirely sure as to its purpouse design wise, are their any cases where it is beneficial to have a private virtual function? ...

Values of Argv when something is not entered from command line

Hi I was wondering what values would argv[1] or argv[2] be, if i failed to provide it with command line arguments ...

Compiling nonessential object files with GCC

Consider the following example g++ a.o b.o c.o -o prog If it is the case that c.o does not contribute any executable code to prog, nor are there any dependencies on c.o in any of the other files, will GCC yet include the contents of c.o in prog? Said another way, aside from compilation time, what (if any) negative consequences can th...

Where to get simple opensource adpcm C\C++ encoder lib?

Where to get simple opensource pcm to adpcm C\C++ encoder lib? ...

what type of data structure would be efficient for searching a process table

i have to search a process table which is populated by the names of processes running on a given set of ip adresses. currently i am using multimaps in C++ with process name as key and ip address as the value. is there any other efficient data structure which can do the same task. also can i gain any sort of parallelism by using pthreads ...

Is Communicating Sequential Processes ever used in large multi threaded C++ programs?

I'm currently writing a large multi threaded C++ program (> 50K LOC). As such I've been motivated to read up alot on various techniques for handling multi-threaded code. One theory I've found to be quite cool is: http://en.wikipedia.org/wiki/Communicating_sequential_processes And it's invented by a slightly famous guy, who's made othe...

dynamical two dimension array according to input

Hi, I need to get an input N from the user and generate a N*N matrix. How can I declare the matrix? Generally, the size of the array and matrix should be fixed at the declaration, right? What about vector<vector<int>> ? I never use this before so I need suggestion from veteran. ...

Common pattern for library initialization and shutdown?

Is there a pattern that I may use for calling the required initialization and cleanup routines of an underlying (C) library? In my case, I would like to create the wrapper class so that it can be composed into other objects. The problem is that, when I destroy the wrapper class, the cleanup routines of the underlying library are called. ...

Prevent unnecessary copies of C++ functor objects

I have a class which accumulates information about a set of objects, and can act as either a functor or an output iterator. This allows me to do things like: std::vector<Foo> v; Foo const x = std::for_each(v.begin(), v.end(), Joiner<Foo>()); and Foo const x = std::copy(v.begin(), v.end(), Joiner<Foo>()); Now, in theory, the compil...

Comparing chars in a character array with strcmp

I have read an xml file into a char [] and am trying to compare each element in that array with certain chars, such as "<" and ">". The char array "test" is just an array of one element and contains the character to be compared (i had to do it like this or the strcmp method would give me an error about converting char to cons char*). Ho...

Splitting the string at Enter key

I'm getting the text from editbox and I'd want to get each name separated by enter key like the character string below with NULL characters. char *names = "Name1\0Name2\0Name3\0Name4\0Name5"; while(*names) { names += strlen(names)+1; } how would you do the same for enter key (i.e separated by /r/n) ? can you d...

Static and shared library symbol conflicts?

I've got a project working on that's using FreeImage and openCV, currently we're using the jpeg support from both of these (I am working towards fixing that, but for now it's got to stay). Anyhow, FreeImage compiles libjpeg 7.0 into its static libraries, and openCV's highgui library links it in as a shared library (on my system, Ubuntu ...

Queue message processing with Multithreading

Hi, I have to design multithreaded module for a problem. And problem is, I have queue, there is a one thread which is putting messages in the message queue, and there are two thread say A and B, thread A process the even message (0,2,4..) and thread B processes the odd message(1,3,5..). I came up with two solution, first one is using tw...

What is the difference between a static and const variable?

Can someone explain the difference between a static and const variable? ...

C++ auto conversions.

For two unrelated classes "class A" and "class B" and a function B convert(const A&); Is there a way to tell C++ to automatically, for any function that takes "class B" as argument, to auto convert a "class A". Thanks! ...

Cubic Spline Interpolation in C++

I am working in image processing in C++ using OpenCV. I've a problem that requires cubic interpolation of a set of data. Are there any library files that I can use for this in OpenCV? ...