c++

Multiple DLLs writing to the same text file?

I want to add logging support to a COM object (DLL) of mine, and there are usually at least two instances of this object loaded. I want both of the DLLs to be able to write lines to the same text file but am worried that this is going to give me problems. Is this possible to achieve? Am I right in thinking that a single Windows API Wr...

MFC's CMFCRibbonGallery and CMFCToolBarImages. Anyone got them to work?

I'm trying to load prepopulate a CMFCToolBarImages instance with HBITMAPs and then pass this to a CMFCRibbonGallery but nothing shows up. I mean the gallery is on the ribbon, and it appears to be sizing itself appropriate but zero interaction or non-background coloured pixels in the central "gallery thumbnail" section. Thoughts anyone? ...

Calling a member function from a member function templated argument

Given the following code which I can't get to compile. template < typename OT, typename KT, KT (OT::* KM)() const > class X { public: KT mfn( const OT & obj ) { return obj.*(KM)(); // Error here. } }; class O { public: int func() const { ...

boost::thread_group - is it ok to call create_thread after join_all?

Hi, I have the following situation: I create a boost::thread_group instance, then create threads for parallel-processing on some data, then join_all on the threads. Initially I created the threads for every X elements of data, like so: // begin = someVector.begin(); // end = someVector.end(); // batchDispatcher = boost::function<void...

Need Help regarding compiling Direct Sound using MinGW or any other C++ compiler if MinGW is not a very viable option

Hello, My problem is that I am trying to create a DLL of a C++ project which uses Direct Sound source and header files. There is a file called dsound.lib which i need to include. When I compile my code I get following errors Compiling source file(s)... RtAudio.cpp RtAudio.cpp:3477:20: dsound.h: No such file or directory RtAudio.cpp: In ...

Rank Tree in C++

We need ADT having search and rank features. That is, in addition to the interface of STL map, a function 'int get_rank(key)' is required. Standard implementation of such function requires supporting and updating an extra integer field in every node of self-balanced searching tree (e.g., in black-red tree, used in STL map/set). But it s...

Converting from "foo<T>" to "const foo<const T>" - C++

I have a function like (please don't care about returning temporary by reference. This is just an example to explain the problem), const foo<const int>& get_const() { foo<int> f; return f; } This obviously won't compile. I am looking for a way to ensure callers won't change the T of foo. How can I ensure that? I have seen the...

_DEBUG vs NDEBUG

Do you prefer #ifdef _DEBUG or #ifndef NDEBUG to specify debug sections of code? Is there a better way to do it? e.g. #define MY_DEBUG. I think _DEBUG is Visual Studio specific, is NDEBUG standard? ...

GCC style weak linking in Visual Studio?

GCC has the ability to make a symbol link weakly via __attribute__((weak)). I want to use the a weak symbol in a static library that users can override in their application. A GCC style weak symbol would let me do that, but I don't know if it can be done with visual studio. Does Visual Studio offer a similar feature? ...

Visual Studio 2008 (C++): Why am I getting compiler warnings?

I am getting Visual Studio compiler warnings from third-party includes and my coworker is not. The following are true: We have checked out the exact same code, .vcproj files, and .sln files, with no local modifications. We are including the exact same third-party files. We are using the exact same version of Visual Studio. We have bot...

MPEG 4 SDK for Windows

Hi there, can anyone recommend a MPEG4 library that will compile(or is compatible) with Intel or Visual C++? EDIT: clarification I was not aware of x264, and ffmpeg does not compile with VC++ (compiles with MingW). Basically I need a library that can be compiled on Windows (or the name of a vendor) that will allow me to extract frames ...

Initialize parent's protected members with initialization list (C++)

Is it possible to use the initialization list of a child class' constructor to initialize data members declared as protected in the parent class? I can't get it to work. I can work around it, but it would be nice if I didn't have to. Some sample code: class Parent { protected: std::string something; } class Child : public Parent...

How to render non trivial particles in OpenGL.

I have a particle system where the positions and various properties are stored in a vertex buffer object. The values are continuously updated by a CUDA kernel. Presently I am just rendering them using GL_POINTS as flat circles. What I am interested in is rendering these particles are more involved things like 3d animated bird models f...

Can I use XPCOM to create and manipulate a Firefox window as I would use win32 COM with IE?

With win32 COM I create an Internet Explorer instance and control it almost fully from my python code (manipulate windows, DOM elements, etc). More specifically, using DispatchEx('InternetExplorer.Application'). Can I do the same using XPCOM and C++/python? I need to automate certain actions taken on the html ui of some websites, so no ...

How do I improve breaking substitution ciphers programmically?

I have written (am writting) a program to analysis encrypted text and attempt to analysis and break it using frequency analysis. The encrypted text takes the form of each letter being substituted for some other letter ie. a->m b->z c->t etc etc. all spaces and non alpha chars are removed and upper case letters made lowercase. An exampl...

Runtime array bounds checking with g++

Is there any way to do array bounds checking with g++? Valgrind can't detect overflows on arrays allocated on the stack. Additionally, the argument -fbounds-checking is only implemented for gcc (according to http://www.lrde.epita.fr/~akim/ccmp/doc/bounds-checking.html). Ideally, the source code shouldn't be modified in any way. ...

how to determine windows update level through IUpdate interface

Hi, I want to count available "important" windows updates in a c++ program. When windows updates reports about available updates, it classifies them by level. In vista the possible levels are {important, recommended, optional} XP : {high-priority, optional} http://www.microsoft.com/windows/downloads/windowsupdate/updatelevels.mspx I ...

Set up Eclipse C++ compiler without auto-install or altering System Path on Windows

I am trying to install a C++ compiler on Eclipse without altering the Path variables as I can't, the machine has limited rights. Eclipse obviously runs fine, it's the build that doesn't, it complains about. The first thing I noticed was a warning that said "Unresolved inclusion" for the libary file stdio.h I added the path variable in...

Bitstream to Float Type Coercion

I'm having trouble getting the following code to work correctly. Using an online IEEE-754 converter, I wrote out (by hand) to the testData.txt file that is read with the bit string that should signify the floating point number 75.5; the actual cout.write does show that the bit string is as I expect as well. However, when I try to coerc...

Question about Inheritance / Method overriding C++

class Class1 { public: void print() { cout << "test" << endl; } void printl() { print(); } }; class Class2 : public Class1 { public: void print() { cout << "test2" << endl; } }; Why does print() not get overridden in Class2, is there any way a function can be overridden like...