c++

OpenCV Vs ImageMagick?

Hi I have an upcoming project which is about image segmentation i.e. to group the pixels constituting the image into clusters based on certain visual properties of the pixel. We plan to do it in C++ and have zeroed in on two image processing/manipulation libraries - OpenCV and ImageMagick. I'm reading on ImageMagick and it seems it has...

Recursive directory deletion with WIN32

I've written an application that uses the WIN32 api to create a temporarily directory hierarchy. Now, when wanting to delete the directories when shutting down the application I'm running into some problems. So lets say I have a directory hierarchy: C:\temp\directory\subdirectory\ I'm using this recursive function bool Dir::delete...

Crystal Reports seems to have an 80 section per group limit

Crystal Reports seems to have an 80 section per group limit Environment: Microsoft Windows XP Professional Version 2002 Service Pack 3 Crystal Reports XI (Release 1) Calling the Crystal Reports Engine crpe32.dll version 11.0.0.1445 Via Crystal VCL 11 libraries Via Borland C++Builder 6 Enterprise Suite Version 6.0 (Buil...

Unit and integration testing in C++

I'm going to write a quite large application for school project in C++. So far I'm quite used to TDD in Java and Ruby using JUnit and RSpec. But as far as my experience goes, I've never seen any C/C++ project with any test suite. What library do you recommend for testing in C++? Are there any good mocking/stubbing frameworks for C++? ...

How to initialize an array in a class constructor?

Working in Xcode on Mac OS X Leopard in C++: I have the following code: class Foo{ private: string bars[]; public: Foo(string initial_bars[]){ bars = initial_bars; } } It does not compile and throws the following error: error: incompatible types in assignment of 'std::string*' to 'std::string [0u]' I notice t...

Visual Studio 2008 Profiler - C++ Library Problem

I have two VS2008 C++ projects. One builds a static library (.lib). The other uses that library and builds an executable. I would like to profile the .exe, but am primarily interested in the profile of the code inside the library. When I run the profiler in the .exe project, I only get stats on functions in that project, and the library ...

Complexity of Exceptions

I am playing around with C++ code in my spare time, working on putting together a library that could be used somewhat generically for building RPG type games. Mostly it is focusing on the underlying data structures and functions. I am still a long ways off from working with graphics. My question is this: How complicated should except...

Calculating vertices of a rotated rectangle

Hey guys, I am trying to calculate the vertices of a rotated rectangle (2D). It's easy enough if the rectangle has not been rotated, I figured that part out. If the rectangle has been rotated, I thought of two possible ways to calculate the vertices. 1) Figure out how to transform the vertices from local/object/model space (the ones I ...

implement substring c++

how do you implement substring in C++ that returns pointer to char? (takes pointer to the first letter) say something like char* substr(char* c, int pos, int lenght) ...

Unmanaged dll call to crash a dotnet app?

As part of segmenting my app into separate appdomains in order to catch and recover from an intermittent crash when calling a native dll, I need a way to reliably trigger this type of crash in order to determine if I am catching the appdomain going down correctly. I'm looking for some simple native code (C++ ?) I can compile into a dll,...

Iterate C++ list<derived> as base class

What I want to do is this: class Ba { } class Da : public Ba {} class Db : public Ba {} class Bb // abstract base class that must not be a template. { void Process() { list<Ba*>::iterator pos; // I known the derived class will also derive // from list<Dx*> where Dx derives from Ba for(pos = this-...

why can't I import the 'math' library when embedding python in c?

I'm using the example in python's 2.6 docs to begin a foray into embedding some python in C. The example C-code does not allow me to execute the following 1 line script: import math Using line: ./tmp.exe tmp foo bar it complains Traceback (most recent call last): File "/home/rbroger1/scripts/tmp.py", line 1, in <module> i...

SDL: Initializng TTF problems. Possibly freetype?

Edited: Look at comments below. Short version: Screen simply flashes when I try to run program. int main(int argc, char** args) { bool quit = false; std::ofstream out("error.txt"); if(init() == false) { return 1; } if (load_files() == false) { return 1; } // Render the text me...

Lookup table where most sequential values point to the same object?

Suppose I have a range of keys, say 0 -> 1000 Say 0 - > 99 map to one object 100 -> 251 map to another etc. etc. What is a good way to map a key to an object without having to have an array of 1000 size and a bunch of if (x >= 0 && x <= 99) business? I mean without any logic i.e. a stairstep table ...

Standard Library Containers with additional optional template parameters?

Having read the claim multiple times in articles - I want to add this question to Stackoverflow, and ask the community - is the following code portable? template<template<typename T, typename Alloc> class C> void f() { /* some code goes here ... */ } int main() { f<std::vector>(); } Is the implementation that supplies std::vector...

Trying to make SDL widget in QT4 using SDL_WINDOWID, but can't get widget to show

Hi all! I'm trying to create an SDL drawing canvas inside of a simple QT4 window, following the information provided in the SDL wiki and in another question on this site. The project is an NES emulator using QT and SDL that a friend and I decided we wanted to try creating. Currently, I have a main_window class that will contain the SDL...

How to use cross platform C++ with a WPF C# GUI

I'm currently in a project that need to work both on Mac and Windows. We are using standard portable C++ for all the application logic. However, since we want the app to feel totally native on both platform, the GUI will be written with C#/WPF for Windows and Objective-C/Cocoa for Mac. However, for the windows part, I am wondering what ...

Why does the C++/CLI compiler get confused so easily with symbols?

Here is my code: using namespace System; using namespace System::Collections; using namespace System::Collections::Generic; namespace Tests { ref class MyCollection : public IEnumerable<int> <----HERE! The C# compiler, for instance, will recognize that the only IEnumerable<T> it has in those namespaces is from System::Collections...

how do you call a managed (c#) function from c++?

I have a c# dll project (my_cs_dll.dll) which defines a static class with a static member function. namespace Foo { public static class Bar { public static double GetNumber() { return 1.0; } } } I also have a c++ dll project which is using /clr. #using <my_cs_dll.dll> double get_number_from_cs() { return Foo::Bar...

Controlling mouse in linux

Basically I'm currently using the wiiuse library to get the wiimote working on linux. I want to now be able to control the mouse through the IR readings. Can somebody point me in the right direction as to how to approach this? I know of uinput but there doesn't seem to be a lot of tutorials/guides on the web. I'm working with c/c++ so ...