c++

Use C++ class from C#

Alright so I have this C++ image capturing class. I was wondering if I could get some help..I know basic C++ (I have done one intro to c and one intro to c++ class) and I have NO idea how to do this: I need to use this class (ie create a new c++ project in my solution) and use c# to reference it and use it to save a screenshot of the s...

What's the best way to get started in modern game programming and application programming?

I want to get started game programming in C/C++, or C# with DirectX or OpenGL. I'm not really sure what I want to get started, but a smallish project like a simple engine would be nice to get started with. Additionally, I would like to learn about designing applications in Windows with C#, .NET 3.5, and WPF. Utilizing C# and .NET, I inte...

using declaration with enum?

using declaration does not seem to work with enum type class Sample{ public: enum Colour { RED,BLUE,GREEN}; } using Sample::Colour; does not work!! do we need to add using declaration for every enumerators of enum type? like below using sample::Colour::RED; ...

exception hierarchy vs error enumeration

I read somewhere (can't find it now) that large exception hierarchies are a waste of time. The justification for this statement seemed sound at the time and the idea stuck with me. In my own code when I have a code base that can have a range of error conditions I use a single exception with an enumeration member to differentiate betwee...

Passing object ownership in C++

What is the best way to indicate that an object wants to take ownership of another object? So far, I've been using a std::auto_ptr in the public interface, so the client knows that the interface wants to take ownership of the passed object. However, the latest GCC tells me auto_ptr is deprecated, so I wonder what is recommended? boost::...

How to track memory allocations in C++ (especially new/delete)

How can I track the memory allocations in C++, especially those done by new/delete. For an object, I can easily override the operator new, but I'm not sure how to globally override all allocations so they go through my custom new/delete. This should be not a big problem, but I'm not sure how this is supposed to be done (#define new MY_NE...

Testing framework for functional/system testing for C/C++?

For C++, there are lots of good unit test frameworks out there, but I couldn't find a good one for functional testing. With functional testing, I mean stuff which touches the disk, requires the whole application to be in place etc. Point in case: What framework helps with testing things like whether your I/O works? I've got a hand-rolle...

Query building in a database agnostic way

In a C++ application that can use just about any relational database, what would be the best way of generating queries that can be easily extended to allow for a database engine's eccentricities? In other words, the code may need to retrieve data in a way that is not consistent among the various database engines. What's the best way ...

How to make a single static library from multiple static libraries?

Hello everyone, We recently converted a C++ project from Visual Studio 6 to Visual Studio 8. Everything went well until we reached the compilation of a project who put all the static libraries inside one big static library. By default after the conversion between the two version of projects the project didn't do anything (no big static ...

Has anyone used smartwin (a Windows C++ GUI OS library)?

I am considering using smartwin for a Windows platform only C++ project but notice that there has not been a release for 18months since 2.0rc5 was released i.e. it appears that it is no longer maintained. After playing with it seems pretty good, I like it's use of templates, signals/slots (via boost) and it will meet the project needs ...

Gently kill a process

I have a Windows service(C#), that sprawns few child native processes (C++). I'd like to gently kill those processes once in a while. (gently = let the procs to finalize its work before going down). I tried to use the SetConsoleCtrlHandler() routine to register the child procs to console events and to call the CloseMainWindow() from t...

C++ .NET equivalent to java public static void main()?

In java I can simply test classes directly with public static void main() I then just add quick code and under Eclipse "Run" the class. Is there anything similar in C++ .NET ? Right now I have to create an empty project, reference the correct headers then set that project as start up project. ...

Building a subset of boost in windows

Hi! I'm trying setup a subset of boost and get it properly compiled using bjam, however I'm not getting the result I'm looking for. I'm working on windows using boost 1.37.0. Let's say I want the libraries smart_ptr and filesystem built/installed. I intentionally chose a header only library and one library needing to compile a library....

Function pointer to class member function problems

First of all I have to admit that my programming skills are pretty limited and I took over a (really small) existing C++ OOP project where I try to push my own stuff in. Unfortunately I'm experiencing a problem which goes beyond my knowledge and I hope to find some help here. I'm working with a third party library (which cannot be change...

Regular Expression to match {if cond}foo{else}bar{/if}

Hi, I'm having difficulty throwing away the bits of the expression I don't want, and keeping the bits I do. The problem is - given the input string: {if cond}foo{else}bar{/if} I'd like just to have: 0: {if cond}foo{else}bar{/if} 1: cond 2: foo 3: bar And for the input string: {if cond}foo{/if} I'd like just to have: 0: {if co...

Dictionary like implementation in C/C++ (Update info)

Does anyone have information or example of how to mount the equivalent of a Dictionary (VB6) in C or C++ ? This implementation is used to be passed as a parameter called DLL VB6. My intention is to create a Dictionary in C (win32 using VARIANT/ARRAYs, etc) and pass it to call a VB. So I have to learn how to create this data structure. ...

How to convert a single char into an int

I have a string of digits, e.g. "123456789", and I need to extract each one of them to use them in a calculation. I can of course access each char by index, but how do I convert it into an int? I've looked into atoi(), but it takes a string as argument. Hence I must convert each char into a string and then call atoi on it. Is there a be...

best way to programmatically modify excel spreadsheets

Hi, I'm looking for a library that will allow me to programatically modify Excel files to add data to certain cells. My current idea is to use named ranges to determine where to insert the new data (essentially a range of 1x1), then update the named ranges to point at the data. The existing application this is going to integrate with i...

What is the best ORB for Java/C++ interoperation using CORBA?

I have a client-server application written in Java using CORBA for the communication. The ORB used is orbd, the one provided by the Java6 platform. I have to replace the Java server implementation with another one written in C++. So the question is, of the free source implementations of CORBA libraries, which one better interoperates wit...

Linking issue with indirect dependencies on Mac OS X

Hi all, we have some linking problems with indirect dependencies. Guessing from what I read on the web it may be because of two-level namespace usage. This happens when we link against a boost library, boost_filesystem to be precise, which itself depends on boost_system. The linker doesn't resolve the dependency between boost_filesystem ...