c++

What exactly does a debugger do?

Hi everyone, I've stumbled onto a very interesting issue where a function (has to deal with the Windows clipboard) in my app only works properly when a breakpoint is hit inside the function. This got me wondering, what exactly does the debugger do (VS2008, C++) when it hits a breakpoint? ...

Getting GPU clock speeds with SetupDiEnumDeviceInfo

Hi everyone! I posted a question earlier regarding obtaining GPU clock speeds, but I guess the thread appeared as already answered since someone had replied to it. I'd been advised by one of your members to try extracting GPU clock speeds using SetupDiEnumDeviceInfo. However, I looked around at some examples, like this one: http://ww...

CPP to Java conversion

Here's my scenario. I have an application written in C++ but not the complete source but the "meat" of it is there. I also have a compiled exe of this application. It communicates to a server somewhere here on our network. I am trying to replicate the C++ code in java, however it uses dwords and memory references, sizeof etc, all thi...

Overloading operators in C++

See edit at the end I am trying to overload the + operator in C++ to allow me to add two complex numbers. (add the real and add the imaginary). Here is my overloaded function: ComplexNum operator+(ComplexNum x, ComplexNum y){ ComplexNum result; result.real = (x.getReal() + y.getReal()); result.imag = (x.getImag() + y.getImag()); retu...

UINT16 value appears to be "backwards" when printing.

I have a UINT8 pointer mArray, which is being assigned information via a *(UINT16 *) casting. EG: int offset = someValue; UINT16 mUINT16 = 0xAAFF *(UINT16 *)&mArray[offset] = mUINT16; for(int i = 0; i < mArrayLength; i++) { printf("%02X",*(mArray + i)); } output: ... FF AA ... expected: ... AA FF ... The value I am expecting t...

about compilation error in Visual C++

Error 1 error C2039: 'memchr' : is not a member of '`global namespace'' c:\program files\microsoft visual studio 9.0\vc\include\cstring 19 new project 17 ...

C++ Multitargeting in VS2010 Beta 2

Does anyone know if there is a way to get the new multi-targeting in VS2010 Beta 2 to target v8 toolset? ...

Is there a database access library for C and/or C++ with a similar interface to Perl's DBI?

I'm willing to write a subset of Perl's DBI interface for libodbc (or unixODBC) in C++. I believe doing so will allow me concentrate better on my goal. BTW, I prefer avoiding to reinvent the wheel, if of course something similar is already out there. ...

Attach child process to debugger automatically

If the main process is currently being debugged in Visual Studio, how can I have it so any new processes it spawns are also attached to the same instance of Visual Studio as the main process is? Currently the new processes are created just with a CreateProcess call, however I can add extra code or use a different API altogether if neede...

Template Polymorphism not Working?

I'm building a small template hierarchy and try to make use of class polymorphism. Here's some example code (which does not compile) to demonstrate it: template<typename T> struct A {}; template<typename T> struct B { B (A<B> *) {} }; struct C : public B<int> { C(A<C> *p) : B<int>(p) {} // error }; int main() { A<C> ac; ...

solving identifier "xxx" is undefined

Hi All, I am experiencing something weird that I dont quite understand. I am getting errors like: framework/CP_STLArrayDefines.h(37): error: identifier "CP_String" is undefined typedef std::vector<CP_String, std::allocator<CP_String> > CP_Strings_Array; ^ framework/CP_STLArrayDefines.h(37): error: iden...

How do declare an extern "C" function pointer

So I have this code: #include "boost_bind.h" #include <math.h> #include <vector> #include <algorithm> double foo(double num, double (*func)(double)) { return 65.4; } int main(int argc, char** argv) { std::vector<double> vec; vec.push_back(5.0); vec.push_back(6.0); std::transform(vec.begin(), vec.end(), vec.begin(), boost::bi...

class relationships UML diagrams

I have my class structure as follows add.h has class add that has method int add(int,int) and add.cpp includes add.h and defines method add above sub.h has class sub that has method int sub(int,int) and sub.cpp includes sub.h and defines method sub now, main.h has class main and it includes add.h and sub.h; main class also has some pr...

Converting a UINT16 value into a UINT8 array[2]

This question is basically the second half to my other Question How can I convert a UINT16 value, into a UINT8 * array without a loop and avoiding endian problems. Basically I want to do something like this: UINT16 value = 0xAAFF; UINT8 array[2] = value; The end result of this is to store value into a UINT8 array while avoiding end...

Overriding / modifying C++ classes using DLLs

I have a project with a large codebase (>200,000 lines of code) I maintain ("The core"). Currently, this core has a scripting engine that consists of hooks and a script manager class that calls all hooked functions (that registered via DLL) as they occur. To be quite honest I don't know how exactly it works, since the core is mostly und...

Why aren't my CTreeCtrl checkboxes checking?

I've got a MFC CTreeCtrl stuck in a dialog with the TVS_CHECKBOXES style turned on. I get checkboxes next to all my tree items fine. In OnInitDialog I set the checked state of some of the items using CTreeCtrl::SetCheck but none of the items in the tree are checked when the tree is displayed. SetCheck is returning TRUE. Checking items wi...

Spell checker for comments, strings, maybe more

I am looking for a spell checker for c++ source code. Unfortunately all I can find is Visual Studio specific. I would like something which works on Linux. Edit: Ultimately I want to automate it in some way. I am not very proficient in spell checking, but what I am thinking of is a not-interactive console tool which prints error messag...

Does the Intel C++ Compiler have a resource compiler?

If so, what's the name of the command line tool to compile resources? Or an example of use... I have access to the Professional suite (both Linux and Windows environment but I'm interested mainly in the Windows one), thanks in advance. ...

Web Application Frameworks: C++ vs Python

Hello, I am familiar with both Python and C++ as a programmer. I was thinking of writing my own simple web application and I wanted to know which language would be more appropriate for server-side web development. Some things I'm looking for: It has to be intuitive. I recognize that Wt exists and it follows the model of Qt. The one t...

How to Call C++ Class Library From VB6

How do I make a C++ class library COM-Visible, and call it from VB6 code? ...