c++

Unable to compile basic GLIB program after GLIB install

I can't seem to compile this basic program using glib.h... #include glib.h #include stdio.h int main () { return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ; return 0; } glib.h is located in /usr/local/include/glib-2.0 So I compiled with $ gcc -v -c -mcpu=v9 -I/usr/local/include/glib-2.0 testme2.c ...

Maven learning curve & overhead for small/medium projects?

what would be (rough estimation, average, of course) the initial learning and setup curve and subsequent overhead for using Maven for C++/Eclipse/Linux project of small to medium size? We are 4 developers at the beginning of the way. We currently have ~20 native eclipse C++ (CDT) "projects", which we compile interactively. We would like...

What is the best embedded system board/chip combination for video pass through with a HTML overlay.

Hi, I am trying to build a proof of concept for a consumer electronic product that will have a video input & output, but will output with an HTML overlay on part of the screen. Does anyone know of the best board/chip combination that would be good for this application? Since it may become a real product, the lower the price the bett...

machine precision and max and min value of a double-precision type

Hi, (1) I have met several cases where epsilon is added to a non-negative variable to guarantee nonzero value. So I wonder why not add the minimum value that the data type can represent instead of epsilon? What are the difference problems that these two can solve? (2) Also I notice that the inverse of the maximum value of a double prec...

Implications of template declaration & definition

From what I understand template classes and template functions (for the most part) must be declared and defined in the same header file. With that said: Are there any other ways to achieve separate compilation of template files other than using particular compilers? If yes, what are those? What, if any, are the drawbacks of having the ...

Particle stream should be the same length regardless of emitter speed

Hi, I'm writing a particle system for our student game, and I've run into a bit of a snag. I want to improve the effect on the ships' rockets, but I can't seem to figure out how. Here's how the effect looks on a stationary ship: And here's how it looks on a moving ship: I want the flames to be the same length consistently. Here's...

Using enum with string variables

Hi, I'm trying to do something like this, enum Data_Property { NAME, DATETIME, TYPE, }; struct Item_properties { char* Name; char* DateTime; int Type; }; int main() { std::string data = "/Name Item_Name /DATETIME [TimeStamp] /TYPE [Integer value]"; std::list <std::string> known_properties; known_properties.push_back("/Na...

Objective C in C++ – Out of Scope

Hello, I have a little problem with the WOsclib. Not particularly with the library, it's more the callback function. The listen to specific osc commands i have to put up some callback method like void TheOscStartMethod::Method( const WOscMessage *message, const WOscTimeTag& when, ...

Error interface in cpp

I am designing a software that has two logical layers, say A and B. Layer B has set of objects (classes). Layer A uses set of APIs exposed by layer B objects for information retrieval. I want to design a generic error interface across layer B objects that can be exposed to layer A. What would be the best way to write a generic error inte...

Static library API question (std::string vs. char*)

I have not worked with static libraries before, but now I need to. Scenario: I am writing a console app in Unix. I freely use std::string everywhere because it's easy to do so. However, I recently found out that I have to support it in Windows and a third party application would need API's to my code (I will not be sharing source, just...

Template class and class properties that are also templates

I'm having trouble compiling the following header. It's my first experience with templates and I guess I'm getting something wrong. The compilers point errors at vector<vector<T>> data_; and the operator overloading function. I would like the data_ vector to have the same type as the OptBaseMatrix object but I'm not sure how to do it... ...

What is *.o file?

Hi guys. I'm compiling own project. And it halted by this error: LINK||fatal error LNK1181: cannot open input file 'obj\win\release\src\lua\bindings.o'| Compiling using Code::Blocks with VS 2005/2008 compiler under win7. There are also lot of another empty directories where *.o files are missing. What do they do? ...

inverse distance weighting interpolation

I would like to compute a weight as reciprocal of a distance for something like inverse distance weighting interpolation (http://en.wikipedia.org/wiki/Inverse_distance_weighting). double wgt = 0, wgt_tmp, result = 0; for (int i = 0; i < num; i++) { wgt_tmp = 1.0/dist[i]; wgt += wgt_tmp; result += wgt_tmp * values[i]; } results ...

Read() from file descriptor hangs

Hey, hopefully this should be my last PTY-related question and I can move onto more exciting issues. (c; Here's a set of small functions I have written for creating and reading/writing to a pty: http://pastebin.com/m4fcee34d The only problem is that they don't work! After I run the initializer and writeToPty( "ls -l" ) , 'output' from...

Why does this C++0x program generates unexpected output?

This program: test_header.hpp #include <boost/signal.hpp> #include <utility> class Sensor; class Recorder : public ::boost::signals::trackable { public: explicit Recorder(int id) : id_(id) {} // Cannot be copied Recorder(const Recorder &) = delete; Recorder &operator =(const Recorder &) = delete; // But can be moved...

stdin/stdout communication between Java program and C program under 64 bit windows 7

I have a C program which gets spawned from a Java program. The C program is mine, while the Java program is third party. The Java program somehow sets things up so that it communicates with my program via stdin/stdout. The system has been working fine under 32-bit Windows XP for years. I have just purchased a new machine with 64-bit Win...

Is there an open-source c/c++ implementation of IEEE-754 operations?

Hi, I am looking for a reference implementation of IEEE-754 operations. Is there such a thing? ...

C/C++: How to store data in a file in B tree

Hello, It appears to me that one way of storing data in a B-tree as a file can be done efficiently with C using binary file with a sequence (array) of structs, with each struct representing a node. One can thus connect the individual nodes with approach that will be similar to creating linked lists using arrays. But then the problem that...

Is it possible to package WPF window as COM Object

I am trying to use a WPF window from a legacy c++ unmanaged gtk gui application. Is it possible to package the WPF window (including the xaml file) and use it in the c++ gui application as a regular com object. Do you foresee any issues or problems with this approach? If possible any links or tutorials or any suggestions on how to do it...

Using RAII with a character pointer.

I see a lot of RAII example classes wrapping around file handles. I have tried to adapt these examples without luck to a character pointer. A library that I am using has functions that take the address of a character pointer (declared like get_me_a_string(char **x)). These functions allocate memory for that character pointer and leave ...