c++

What are some good compilers to use when learning C++?

What are some suggestions for easy to use C++ compilers for a beginner? Free or open-source ones would be preferred. ...

Can operator>> read an int hex AND decimal?

Can I persuade operator>> in C++ to read both a hex value AND and a decimal value? The following program demonstrates how reading hex goes wrong. I'd like the same istringstream to be able to read both hex and decimal. #include <iostream> #include <sstream> int main(int argc, char** argv) { int result = 0; // std::istringstre...

What is an easy way to create a MessageBox with custom button text in Managed C++?

I would like to keep the overhead at a minimum. Right now I have: // Launch a Message Box with advice to the user DialogResult result = MessageBox::Show("This may take awhile, do you wish to continue?", "Warning", MessageBoxButtons::YesNo, MessageBoxIcon::Exclamation); // The test will only be launched if the user has selected Yes on t...

Multithreaded Debugger

GDB has severe issues when debugging with multiple threads (pthreads). Are there any other good multi-threaded debuggers for C/C++ on *nix? ...

Need gcc/g++ working on SCO6

Has anyone found a way to get gcc to build/install on SCO6? With 2.95 and 4.3 I get to the point where it needs to use (2.95) or find (4.3) the assembler and that's where it fails. If anyone has figured this out I would appreciate the info! Thanks ...

Java operator overload

Coming from C++ to Java, the obvious unanswered question is why not operator overload. On the web some go about: "it's clearly obfuscated and complicate maintenance" but no one really elaborates that further (I completely disagree, actually). Other people pointed out that some objects do have an overload (like String operator +) but t...

C++ runtime knowledge of classes

I have multiple classes that all derive from a base class, now some of the derived classes will not be compiled depending on the platform. I have a class that allows me to return an object of the base class, however now all the names of the derived classes have been hard coded. Is there a way to determine what classes have been compiled...

Custom events in C++?

Is it possible to create custom events in C++? For example, say I have the variable X, and the variable Y. Whenever X changes, I would like to execute a function that sets Y equal to 3X. Is there a way to create such a trigger/event? (triggers are common in some databases) ...

How to iterate over all the page breaks in an Excel 2003 worksheet via COM

I've been trying to retrieve the locations of all the page breaks on a given Excel 2003 worksheet over COM. Here's an example of the kind of thing I'm trying to do: Excel::HPageBreaksPtr pHPageBreaks = pSheet->GetHPageBreaks(); long count = pHPageBreaks->Count; for (long i=0; i < count; ++i) { Excel::HPageBreakPtr pHPageBreak = pHPag...

How do I create RAW TCP/IP packets in C++?

I'm a beginning C++ programmer / network admin, but I figure I can learn how to do this if someone points me in the right direction. Most of the tutorials are demonstrated using old code that no longer works for some reason. Since I'm on Linux, all I need is an explanation on how to write raw Berkeley sockets. Can someone give me a qui...

"foreach values" macro in gcc & cpp

I have a 'foreach' macro I use frequently in C++ that works for most STL containers: #define foreach(var, container) \ for(typeof((container).begin()) var = (container).begin(); \ var != (container).end(); \ ++var) (Note that 'typeof' is a gcc extension.) It is used like this: std::vector< Blorgus > blorgi = ...; foreac...

How to test function call order

Considering such code: class ToBeTested { public: void doForEach() { for (vector<Contained>::iterator it = m_contained.begin(); it != m_contained.end(); it++) { doOnce(*it); doTwice(*it); doTwice(*it); } } void doOnce(Contained & c) { // do something } void doTwice(Contained & c) { // do so...

C++ gdb GUI

Briefly: Does anyone know of a GUI for gdb that brings it on par or close to the feature set you get in the more recent version of Visual C++? In detail: As someone who has spent a lot of time programming in Windows, one of the larger stumbling blocks I've found whenever I have to code C++ in Linux is that debugging anything using comm...

Best C++ IDE for *nix

What is the best C++ IDE for a *nix envirnoment? I have heard the C/C++ module of Eclipse is decent as well as Notepad++ but beyond these two I have no real idea. Any thoughts or comments? ...

What is best for desktop widgets (small footprint and pretty graphics)?

If I were to want to create a nice looking widget to stay running in the background with a small memory footprint, where would I start building the windows application. It's goal is to keep an updated list of items off of a web service. Similar to an RSS reader. note: The data layer will be connecting through REST, which I already have...

Which is the best Linux C/C++ debugger (or front-end to gdb) to help teaching programming?

I teach a sort of "lite" C++ programming course to novices ("lite" meaning no pointers, no classes, just plain old C, plus references and STL string and vectors). Students have no previous experience in programming, so I believe that using an interactive debugger would help them understand program flow, variables, and recursion. The cou...

What's the best way to do fixed-point math?

I need to speed up a program for the Nintendo DS which doesn't have an FPU, so I need to change floating-point math (which is emulated and slow) to fixed-point. How I started was I changed floats to ints and whenever I needed to convert them, I used x>>8 to convert the fixed-point variable x to the actual number and x<<8 to convert to f...

How to determine which version of Direct3D is installed?

We have an application which needs to use Direct3D. Specifically, it needs at least DirectX 9.0c version 4.09.0000.0904. While this should be present on all newer XP machines it might not be installed on older XP machines. How can I programmatically (using C++) determine if it is installed? I want to be able to give an information messag...

Can anyone recommend a IOC Container for C++?

I miss dependency injection more than all the raindrops in the ocean. ...

Why can't I single-step Clipboard-code within the VS.NET debugger ?

Ideally the reader has upgraded a native C++ program to Visual Studio 2008, which contains an OpenClipboard() block. Why not try setting a breakpoint just after getting a successful return-code from OpenClipboard() and step through your code. According to the Internet it may work on your system, but of course, not on mine, thanks for t...