c++

Clrdump (C++) error LNK2019: unresolved external symbol __imp__RegisterFilter@8 referenced in function _main

I am using a makefile system with the pvcs compiler (using Microsoft Visual C++, 2008 compiler) and I am getting several link errors of the form: error LNK2019: unresolved external symbol __imp__RegisterFilter@8 referenced in function _main This is happening DESPITE using the extern "C" declaration, viz.: extern "C" int CLRDUMP_AP...

How to know a QTreeWidget selected item?

I have a class that inherits by QTreeWidget, how can I know the actually selected row? I explain, usually we connect signals to slots by this way: connect(myButton, SIGNAL(triggered(bool)), this, SLOT(myClick())); I can't find nothing to similar for QTreeWidget->QTreeWidgetItem. The only way I found is this: redefining the mousePressE...

Hosting CLR - Bad parameters

Hello, I'm trying to host the CLR inside my C++ application and I'm having problems invoking the entry point of the managed application. The entry point is defined as usual: static void Main(string[] args) And here's the actual C++ code: CComPtr<_MethodInfo> entryPoint; hr = assembly->get_EntryPoint(&entryPoint); // this works just ...

List iterator not incrementable error message in C++

Hi there, As a newbie I'm trying to implement a sorting function in C++, using the list-class. However, running the code I get the error that the list iterator is not incrementable... However it seems very unlikely as it should be incrementable! code: void shuffle (list<int> &list1) { list<int> smaller; list<int> larger; ...

How to Create a Gdiplus::Bitmap from an HBITMAP, retaining the alpha channel information?

When I create a new Gdiplus::Bitmap using the Bitmap::FromHBITMAP function, the resulting Bitmap is opaque - none of the partial transparency from the original HBITMAP is preserved. Is there a way to create a Gdiplus::Bitmap from an HBITMAP which brings across the alpha channel data? ...

Using boost::shared_ptr in a library's public interface

We have a C++ library that we provide to several different clients. Recently we made the switch from using raw pointers in the public interface to using boost::sharedptr instead. This has provided an enormous benefit, as you might guess, in that now the clients no longer have to worry about who needs to delete what and when. When we made...

Finding C++ static initialization order problems

We've run into some problems with the static initialization order fiasco, and I'm looking for ways to comb through a whole lot of code to find possible occurrences. Any suggestions on how to do this efficiently? Edit: I'm getting some good answers on how to SOLVE the static initialization order problem, but that's not really my questio...

Where does Visual Studio look for C++ Header files?

Okay, C++ newbie question here. I checked out a copy of a C++ application from SourceForge (HoboCopy, if you're curious) and tried to compile it, but Visual Studio tells me that it can't find a particular header file. I found the file in the source tree, but where do I need to put it so that it will be found when compiling? Are there ...

How do you find the least optimized parts of a program?

Are there any tools to give some sort of histogram of where most of the execution time of the program is spent at? This is for a project using c++ in visual studio 2008. ...

how to display thumbnails in listview like explorer does?

could you please point c++ code example to display videos and images thumbnails in listview? ...

Can you really have a function/method without a body but just a try/catch block?

Note that this function does not have a "{" and "}" body. Just a try/catch block: void func( void ) try { ... } catch(...) { ... } Is this intentionally part of C++, or is this a g++ extension? Is there any purpose to this other than bypass 1 level of {}? I'd never heard of this until I ran into http://stupefydeveloper.blog...

Discarding the output of a function that needs an output iterator

Suppose there´s a template function in C++ that does some useful work but also outputs a sequence of values via an output iterator. Now suppose that that sequence of values sometimes is interesting, but at others is not useful. Is there a ready-to-use iterator class in the STL that can be instantiated and passed to the function and will ...

Rolling my own exceptions

I am writing some new code that will throw a custom exception - I want to include an error string and a status code. Which class should be exception derive from? std::exception? std::runtime_error? Any other 'gotchas' to worry about? I'm thinking of something like the following: class MyException : public std::exception(?) { public:...

What does a const pointer-to-pointer mean in C and in C++?

I know the rule-of-thumb to read declarations right-to-left and I was fairly sure I knew what was going on until a colleague told me that: const MyStructure** ppMyStruct; means "ppMyStruct is a pointer to a const pointer to a (mutable) MyStructure" (in C++). I would have thought it meant "ppMyStruct is a pointer to a pointer to a con...

"Step over" when debugging multithreaded programs in visual studio

One thing that annoys me when debugging programs in visual studio (2005 in my case) is that when I use "step over" (by pressing F10) to execute to the next line of code, I often end up reaching that particular line of code in a totally different thread than the one I was looking at. This means that all the context of what I was doing was...

to use a library dll with LoadLibrary() method on C++

Can I use LoadLibrary method for to import a data of type struct?? excuse me for my English. thanks. ...

How loader Maps DLL in to Process Address Space

I am curious to know How the Loader Maps DLL in to Process Address Space. How loader does that magic. Example is highly appreciated. Thanks in advance. ...

How can I run code on Windows Mobile while being suspended?

I'd like to run some C++ code while the Windows Mobile PocketPC is (or seems) being suspended. An example what I mean is the HTC Home plugin that shows (among others) a tab where the HTC Audio Manager can be used to play back mp3 files. When I press the on/off button, the display goes black, but the audio keeps playing. The only button t...

Memory management practices and tools for Symbian C++

Hi, I have pretty much finished my first working Symbian application, but in my hastened learning have paid little attention to memory management and pushing to and cleaning up the stack? Could somebody please point me in the direction of some of the best practises to use here, and maybe some of the best leak detection/memory profiling...

Matrix Template Library matrix inversion

I'm trying to inverse a matrix with version Boost boost_1_37_0 and MTL mtl4-alpha-1-r6418. I can't seem to locate the matrix inversion code. I've googled for examples and they seem to reference lu.h that seems to be missing in the above release(s). Any hints? @Matt suggested copying lu.h, but that seems to be from MTL2 rather than MTL4....