c++

How does the C++ STL vector template store its objects in the Visual Studio compiler implementation?

I am extending the Visual Studio 2003 debugger using autoexp.dat and a DLL to improve the way it displays data in the watch window. The main reason I am using a DLL rather than just the basic autoexp.dat functionality is that I want to be able to display things conditionally. e.g. I want to be able to say "If the name member is not an em...

QtCreator performance on Windows

I've finally managed to run the QtCreator debugger on Windows after struggling with the Comodo Firewall incompatibilities. I was hoping to switch from an older version of Qt and Visual C++ to the newest version of Qt and QtCreator, but the debugger performance is atrocious. I have created a simple GUI with one window that does nothing...

How do I handle combinations of behaviours?

I am considering the problem of validating real numbers of various formats, because this is very similar to a problem I am facing in design. Real numbers may come in different combinations of formats, for example: 1. with/without sign at the front 2. with/without a decimal point (if no decimal point, then perhaps number of decimals can ...

ios::nocreate error while compiling a C++ code

While, compiling a package, written in C++ on RHEL 5.0. I am getting the following error. > error: nocreate is not a member of std::ios The source-code corresponds to: ifstream tempStr(argv[4],ios::in|ios::nocreate); I have tried #g++ -O -Wno-deprecated <file.cpp> -o <file> as well as: #g++ -O -o <file> Please sugg...

Debug c++ dll in csharp

Hello, I have a .dll from c++ and i want to debug it in Csharp, but i don't know how to do. When i compiled the c++ project, Visual studio asked me to execute an ".exe" I supposed that i had to create a project to execute the dll. But i'm some lost, anyone have suggestions? ( sorry for my english, i'm french ) ...

VirtualAlloc failing on certain configurations of hdd

For some reason on my application when running on some configuration of hard disk (RAID, random partitions, through a separate IDE controller, not on the operating systems partition), VirtualAlloc returns null with the GetLastError code of ERROR_INVALID_PARAMETER. The only parameter apart from the flags (MEM_COMMIT | MEM_TOP_DOWN, PAGE...

Usage of volatile specifier in C/C++/Java

While going through many resources on multithreaded programming, reference to volatile specifier usually comes up. It is clear that usage of this keyword is not a reliable way to achieve synchronization between multiple threads atleast in C/C++ and Java (versions 1.4 and earlier). Here is what wikipedia lists (without explaining how) as ...

Select() not Working in thread

Hi all, I have to monitor a serial port and process its data. As a test program I was using select for just one port. The run function is as follows: void <ProtocolClass>::run() { int fd = mPort->GetFileDescriptor(); fd_set readfs; int maxfd=1; int res; FD_ZERO(&readfs); FD_SET(fd,&readfs); struct timeval Ti...

Is it possible to add CMFCToolBar to a dialog?

Hi! I just tryed the standard way for adding CToolbar to a dialog on the new CMFCToolBar. But it doesn't work. Befor I dip into the new implementation, I want to know if it actually possible? ...

Generating a static library and an executable with a single installation (autoconf)

I know how to build a project or how to create a library using autoconf. What I want to achive is to generate a static library and use this library to build a project in a single configure/make/make install run. I want some source files to be put into library and the rest to be compiled using this library. How do I modify makefile.am ...

How to display map contents?

Hi I have a map map < string , list < string > > mapex ; list< string > li; how to display the above map items on the console. ...

QtCreator project with multiple libs and one exe.

Like I said in a previous question, I'm planning on porting a Qt project from VC++ to QtCreator. The project consists of 4 subprojects: 3 of them are libs and the last one makes the exe. The subprojects are layered, meaning that each layer has compile and link time dependencies to the layers beneath it. The files are organized as follo...

MBCS to UTF-8 C++

I'm working on a project in VS2008 that I'm compiling in MBCS but I need to work with some UTF-8 strings to interact with some web services. I wrote a function that works perfectly with Unicode but not MBCS. Is there any way I can convert a MBCS string to UTF-8 or to Unicode? Thanks! ...

Aligned and unaligned memory accesses?

What is the difference between aligned and unaligned memory access? I work on an TMS320C64x DSP, and I want to use the intrinsic functions (C functions for assembly instructions) and it has ushort & _amem2(void *ptr); ushort & _mem2(void *ptr); , where _amem2 does an aligned access of 2bytes and _mem2 does unaligned access. When sh...

Correct way to initialize an object with exception throwing constructor

Hi, This seems to be a trivial question but I got hung on it for a few hours now (maybe too much Java killed my C++ braincells). I have created a class that has the following constructor (i.e. no default constructor) VACaptureSource::VACaptureSource( std::string inputType, std::string inputLocation ) { if( type == "" || location =...

Why not use pointers for everything in C++?

Suppose that I define some class: class Pixel { public: Pixel(){ x=0; y=0;}; int x; int y; } Then write some code using it. Why would I do the following? Pixel p; p.x = 2; p.y = 5; Coming from a Java world I always write: Pixel* p = new Pixel(); p->x = 2; p->y = 5; They basically do the same thing, right? O...

Why is this boost header file not included

...

C++ Process Management

Is there a well known, portable, good library for c++ process management? I found a promising library called Boost.Process (http://www.netbsd.org/~jmmv/process/) but it's only a candidate for inclusion in the Boost library. Has anyone use this? Does anyone know why it isn't a part of Boost? Thanks! ...

How can I use a class from a header file in a source file using extern but not #include?

If I have a class in outside.h like: class Outside { public: Outside(int count); GetCount(); } How can I use it in framework.cpp using the extern keyword, where I need to instantiate the class and call GetCount? Edit: #include is not allowed. ...

Compile Cygwin project in Eclipse

I have a c++ Project that was compiled with the cygwin toolchain, now I want to use Eclipse to compile and test it. If I create a project (cygwin toolchain is set in the options) I get the error: make: *** No rule to make target `all'. 7wWin line 0 C/C++ Problem In Cygwin I use: cd $BUILDDIR make make install Can Eclipse create i...