c++

Linux GUI development

I have a large GUI project that I'd like to port to Linux. What is the best framework to use for GUI programming in Linux? Should KDE / Gnome frameworks be used? Or can I use something more generic other than X? I feel like if I chose one of Gnome or KDE, I'm closing the market out for a chunk of the Linux market who have chosen one ov...

I don't understand std::tr1::unordered_map

I need an associative container that makes me index a certain object through a string, but that also keeps the order of insertion, so I can look for a specific object by its name or just iterate on it and retrieve objects in the same order I inserted them. I think this hybrid of linked list and hash map should do the job, but before I t...

Templates spread across multiple files

C++ seems to be rather grouchy when declaring templates across multiple files. More specifically, when working with templated classes, the linker expect all method definitions for the class in a single compiler object file. When you take into account headers, other declarations, inheritance, etc., things get really messy. Are there any...

Finding out the source of an exception in C++ after it is caught?

I'm looking for an answer in MS VC++. When debugging a large C++ application, which unfortunately has a very extensive usage of C++ exceptions. Sometimes I catch an exception a little later than I actually want. Example in pseudo code: FunctionB() { ... throw e; ... } FunctionA() { ... FunctionB() ... } try...

Variable Holding data in a while statement

I know I must be missing something small but in a while statement how does the variable hold the data when it finishes the first pass and goes into the second pass. ...

What are the differences between "generic" types in C++ and Java?

Java has the generic keyword and C++ provides a very strong programming model with templates. So then, what is the difference between C++ and Java generics? ...

Virtual functions in constructors, why do languages differ?

In C++ when a virtual function is called from within a constructor it doesn't behave like a virtual function. I think everyone who encountered for the first time was surprised but on second thought it makes sense, if the derived constructor hasn't yet run the object is not yet a derived so how can a derived function be called? The precon...

Changing a CORBA interface without recompiling

I'd like to add a method to my existing server's CORBA interface. Will that require recompiling all clients? I'm using TAO. ...

Do you have to register a Dialog Box?

So, I am a total beginner in any kind of Windows related programming. I have been playing around with the Windows API and came across a couple of examples on how to initialize create windows and such. One example creates a regular window (I abbreviated some of the code): int WINAPI WinMain( [...] ) { [...] // Window...

Task oriented thread pooling

I've created a model for executing worker tasks in a server application using a thread pool associated with an IO completion port such as shown in the posts below: http://weblogs.asp.net/kennykerr/archive/2008/01/03/parallel-programming-with-c-part-4-i-o-completion-ports.aspx http://blogs.msdn.com/larryosterman/archive/2004/03/29/10132...

Why can't a forward declaration be used for a std::vector?

If I create a class like so: // B.h #ifndef _B_H_ #define _B_H_ class B { private: int x; int y; }; #endif // _B_H_ and use it like this: // main.cpp #include <iostream> #include <vector> class B; // Forward declaration. class A { public: A() { std::cout << v.size() << std::endl; } private: std::vec...

How do I make a fully statically linked .exe with Visual Studio Express 2005 ?

My current preferred C++ environment is the free and largely excellent Microsoft Visual Studio 2005 Express edition. From time to time I have sent release .exe files to other people with pleasing results. However recently I made the disturbing discovery that the pleasing results were based on more luck that I would like. Attempting to ru...

Get back to basics. How do I get back into C++?

I haven't used C++ since college. Even though I've wanted to I haven't needed to do any until I started wanting to write plugins for Launchy. Is there a good book to read to get back into it? My experience since college is mainly C# and recently ruby. I bought some book for C# developers and it ended up being on how to write C++ with...

How can I assert() without using abort()?

If I use assert() and the assertion fails then assert() will call abort(), ending the running program abruptly. I can't afford that in my production code. Is there a way to assert in runtime yet be able to catch failed assertions so I have the chance to handle them gracefully? ...

GCOV for multi-threaded apps

Is it possible to use gcov for coverage testing of multi-threaded applications? I've set some trivial tests of our code-base up, but it would be nice to have some idea of the coverage we're achieving. If gcov isn't appropriate can anyone recommend an alternative tool (possible oprofile), ideally with some good documentation on getting ...

C++ : What's the easiest library to open video file

I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me. I've tried to use Direct Show with the SampleGrabber filter (using this sample http://msdn.microsoft.com/en-us/library/ms787867(VS.85).aspx), but...

C++: How to extract a string from rapidxml

In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a std::string) RapidXML (http://rapidxml.sourceforge.net/) has been recommended to me, but I can't see how to retrieve the XML back as a text string. (I could iterate over the nodes and attributes and build it myself, but su...

Tutorial on understanding strings in Symbian

Hi! I have Carbide.c++ Developer from Nokia and I want to create applications for my S60 phone. I've looked at the samples that goes with the different SDK's for S60 but I haven't found any simple explanation on how strings, called descriptors, are used in Symbian. One of the problems are that I'm visually impaired and therefore it take...

Asynchronous Mysql connector for C++ or C

Does there exist any asynchronous connectors to Mysql that can be used in C or C++? I'm looking for something that can be plugged into a reactor pattern written in Boost.Asio. [Edit:] Running a synchronous connector in threads is not an option. ...

Are there any good C++ Mock object frameworks?

Does anyone have any experience with Mock Object frameworks in C++? I haven't been able to find much. It appears Google will be open sourcing theirs soon, so I guess it may be best to wait for that, but still interested to hear of others. Just an update the Google's gMock has been out for a while now. ...