c++

"error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject'

Possible Duplicate: error using CArray Duplicate : http://stackoverflow.com/questions/864864/error-using-carray so, i am trying to use CArray like this : CArray<CPerson,CPerson&> allPersons; int i=0; for(int i=0;i<10;i++) { allPersons.SetAtGrow(i,CPerson(i)); i++; } but when compiling my progra...

How can I get a process handle by its name in C++?

I'm trying to get the process handle of, say example.exe, so I can call TerminateProcess on it. How can I do this? Notice, it doesn't have a window so FindWindow won't work. ...

Should I learn C++ based on new or old standard (specification)?

OK, I am considering of getting into c++ development in coming months (there is no set date). I am vaguely familiar with the language (primarily C), as well as some basics of OO, MI, templates, exceptions, patterns, used STL. And now I am at the point in time where I would like to master the language in depth. And the natural question i...

How can I start explorer.exe via C++?

I'm trying to programmatically start explorer.exe but I'm not having any luck. This is my code: cout << pName << "died, lets restart it." << endl; STARTUPINFO startupInfo = {0}; startupInfo.cb = sizeof(startupInfo); PROCESS_INFORMATION processInformation; if(CreateProcess(pName, NULL, NULL, NULL, false, NORMAL_PRIORITY_CLASS, NULL, N...

Generating Symbols in release binaries with Visual Studio

Update: I posted a comment on John Robbins blog about the. He wrote a response here: http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/06/19/do-pdb-files-affect-performance.aspx The project I am working on does not build symbols for its release binaries, and I would like to change this. Some info: Mostly C++ code base, some C...

C++: How come random deletion from a std::vector is faster than a std::list?

How come that random deletion from a std::vector is faster than a std::list? What I'm doing to speed it up is swapping the random element with the last and then deleting the last. I would have thought that the list would be faster since random deletion is what it was built for. for(int i = 500; i < 600; i++){ swap(vector1[i], vector...

Parse Command Line Arguments

Duplicate of: What parameter parser libraries are there for C++? Option Parsers for c/c++? What is the best way of parsing command-line arguments in C++ if the program is specified to be run like this: prog [-abc] [input [output]] Is there a library in STL to do this? Related: Parsing command line arguments in a unicode C+...

"Echo" device for Unit Testing

I'm currently writing up some CPPunit tests for a program that tests a hardware communication port (yes, I'm writing unit tests for a tester app ;-) ). One of the classes I'm testing is basically a wrapper around the device's file descriptor; I make read() and write() calls on the file descriptor. Is there a device file/driver on Linux...

WPF memory fragmentation

Hi all, I've got what I assume is a memory fragmentation issue. We've recently ported our WinForms application to a WPF application. There's some image processing that this application does, and this processing always worked in the WinForms version of the app. We go to WPF, and the processing dies. Debugging into the library has th...

Can't call base class method even though I have a pointer to it (Decorator)?

I have a template class that I've subclassed with a pointer to it (Decorator pattern). I added a getBase() call to return the pointer to the base class for any further subclasses. However, when I use that getBase() and call the base classes only method, I get a linker error that it can't find the symbol for that method in the interveni...

Why does the order of my #includes matter? (C++)

I've created a header file called "list_dec.h", put it in a folder "C:\Headers", and set my compiler to include files from "C:\Headers", so now I can do things like #include<list_dec.h> int main(){return(0);} but when I try to do something like #include<iostream> #include<list_dec.h> int main(){return(0);} I get an error (not anyth...

Why should i learn C++.

Everyone has been telling me to learn C++. Without bashing languages right and left, can someone please state some relevant reasons as to why I should learn C++ today? Note that in no way am I saying anything harsh about C++. I just want to know why I should master it as a programmer instead of the other powerful languages out there. ...

Flickering child windows with alpha channels

When drawing child controls containing bitmaps with per-pixel alpha channels, we are getting quite a lot of flickering whenever they need to be redrawn. The actual blending is working correctly. I've found a lot of info about reducing flicker (such as this question or this site), but I can't seem to find anything that applies specifica...

How to write a simple class in C++?

I have been reading a lot of tutorials on C++ class but they miss something that other tutorials include so. Can some one please show me how to write and use a very simple C++ class that uses visibility, methods and a simple constructor and destructor. ...

Is there a way to define variables of two types in for loop?

This works: int main() { for (int i = 0, j = 0; i < 10; i += 1, j = 2*i) { cout << j << endl; } } ` But this not: int main() { for (int i = 0, float j = 0.0; i < 10; i += 1, j = 2*i) { cout << j << endl; } } Is there a way to define variables of two types in for loop? I don't need to use iterator i inside the loop, ...

In C++ Win32 app how can I determine private bytes, working set and virtual size

I'm writing some code for educational purposes and I'd like to be able to print these memory usage values out from a windows console program written in C++. ...

Lua, C++, and poor man's subclassing

I'm lead dev for Bitfighter, and we're working with a mix of Lua and C++, using Lunar (a variant of Luna, available here) to bind them together. I know this environment does not have good support for object orientation and inheritance, but I'd like to find some way to at least partially work around these limitations. Here's what I ha...

Building with Boost through Visual Studio is not picking the correct VS version or statically linked libs

#include <boost/regex.hpp> int main(void) { return 0; } Error 2 fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_38.lib' This isn't a pathing problem. I intentionally do not have that .lib built, and want to link against the mt-sgd-1_38.lib file, but I don't know what I need to set to have boost's auto-namin...

How to organise source code in a modular manner

I'm currently working on a project that has scope to become quite large, however being relatively new to C++ and coming from a Java background I'm not sure about the best way to proceed. I would like to have a directory structure similar to: + Root - main.cpp + Engine + Core - foo.cpp - foo.h + Utili...

Switching stacks in C++

I have some old code written in C for 16-bit using Borland C++ that switches between multiple stacks, using longjmps. It creates a new stack by doing a malloc, and then setting the SS and SP registers to the segment and offset, resp., of the address of the malloc'd area, using inline Assembler. I would like to convert it to Win32, and ...