c++

Program crashes only when Visual Studio debugging when updating Access database

My problem is that my program only crashes when debugging using Visual Studio. The background: My program comprising various modules accesses an Access 2007 database via one module. I installed Access 2010 to do some testing of it so we can see if we should use that runtime in a upcoming release. I built all my modules in debug and I ca...

Wrapping #include directives with other preprocessor commands

Hi, I'm working on a project that uses lots of external libraries. Now, I like my projects to compile with the highest warning level available, which on MSVC is /W4. I'm also using -Wall on GCC for this project, which needs to be cross-platform. With /W4, I'm hitting a problem: I'm often including the headers of the other libraries, an...

template specialization inside class namespace

How to specialize a template defined in some external namespace in the body of my class? Concrete example using BGL which doesn't compile: class A { namespace boost { template <class ValueType> struct container_gen<SomeSelectorS, ValueType> { typedef std::multiset<ValueType,MyClass<ValueType> > type; }; } } ...

Why can't templates take function local types?

In C++ it's OK to have a funcction that takes a function local type: int main() { struct S { static void M(const S& s) { } }; S s; S::M(s); } but not OK to have a template that does: template<typename T> void Foo(const T& t) { } int main() { struct S { } s; Foo(s); // Line 5: error: no matching function for call to 'Foo(...

Auto detaching objects?

Hi, I have a mother class that stores the pointers to some objects in a list. I want these objects to detach themselves from the list when they are destroyed. Can anyone suggest some good ways to do this please? ...

What is the preferred way of passing data between two applications on the same system?

I have an application (A) that needs to launch another application (B). I need to pass data between the applications. I can think of two approaches. The first is to open a socket. The second is to share data via a dll. The opening socket approach is straight forward. The dll approach I have some questions? I can load plug-in d...

OpenGL: Crashes at random OpenGL function call

I am getting weird problem, the crash happens at random times, for example i managed to use the 3d app for a while without crashing, then most of the times it crashes always when i suddenly render a lot of objects at same time. I have recently noticed that changing the huge texture surface on this ATI card will crash my whole computer ...

XML search algorithm C++

I am trying to find out how to write XML search algorithm. Following is the my File <DUMMYROOT> <root>Job Started</root> <root>Job Running</root> </DUMMYROOT> and I want search string as <root>Job Started</root> I should be able to supply inner level of nodes as a search string like <DUMMYROOT><root1><root2><root3>STRINGTOSEARCH...

Swig: How to wrap double& (double passed by reference)?

I am using SWIG to access C++ code from Python. How do I elegantly wrap a function that returns values in variables passed by reference like void set(double&a) { a = 42.; } I could not find out how to do this. In the best case I'd be able to use the function in Python with Python floats: >>> b = 2. >>> set(b) >>> print b 42.0 At ...

Copy or reference semantics of boost::spirit's rule<>?

I am trying to write a shell language parser in Boost.Spirit. However, I am unclear about some basic issues regarding semantics of rules. Looking at the documentation, there are members r.alias() and r.copy() of rule. IIUC, these members should return a reference to the rule and a copy of the rule's contents, respectively. However, it i...

gdb problem setting hardware watchpoint/how to set software watchpoint

An earlier question explained that on x86 the size of objects being watched is limited by debug registers. here. As expected, I can "watch" a double variable. But I can't watch a double datamember, eg watch pObject->dPrice produces Hardware watchpoint 1: pObject->dPrice But when you try to continue execution, it says Could not in...

Viusal Studio 2010 C++ ATL Web Service

Hi, I want to be able to create the same "hello world" output shown in this tutorial: http://www.codeproject.com/KB/atl/tipoftheday.aspx However I wish to make it use visual studios 2010 ATL project running as a service (EXE), does anyone know where I could find a template or a tutorial that explains how to do this. ...

how to read absolute positions of tap from Cirque touchpad in linux

we have one of Cirque touchpads. http://www.cirque.com/downloads/docs/tsm9925.pdf now we want to read absolute position of tap from this touchpad using c\c++ application. unfortunately company developed only windows drivers but we need to read positions in the linux. we tried to use /dev/input/eventN subsystem but received only directi...

Help needed to debug this c++ program

Hya, i need help to debug this program . // VirtualFN.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <conio.h> #include <string> #include <iomanip> using namespace std; enum isautostart { no,yes }; class vehicle { protected: static int noofvehicles; string vehic...

Visual C++ vs C# with Visual Studio 2010

What are the real benefits from using Visual C++ under Visual Studio 2010 versus C# under Visual Studio 2010 EDIT: I'm asking for a pro/con type of thing here ...

Pthreads- 1 lock, 2 unlocks

If I understand correctly, then foo1() fails to unlock &private_value_. As a result, foo2()'s thread_mutex_lock does not work since foo1() never released it. What are the other consequences? int main ( ... ) foo1(); foo2(); return 0; } foo1() { pthread_mutex_lock(&private_value_); do something // no unlock! } foo2() { pthread_...

boost bind template error

//error C2784: 'HRESULT get_wrapper(T *,boost::function<R(void)>)' : //could not deduce template argument for 'boost::function<R(void)>' //from 'boost::_bi::bind_t<R,F,L>' STDMETHODIMP CAttributeValue::get_Name(BSTR* pVal) { return get_wrapper(pVal, boost::bind<BSTR>(&CAttributeValue::getNameCOM, this)); //error here } template <...

Unsafe to throw exceptions from statically linked C++ libraries?

I've heard that throwing exceptions in/from a C++ library could be potentially dangerous, particularly with DLLs, and particularly if the calling code and the library are compiled with different compilers. Is there any truth to this? Is it safe as long as I stick to static libraries? Note that I am not talking about internal use of excep...

Cause of seemingly random crashes in wininet.dll?

I am getting crashes deep in wininet.dll. It crashed trying to read the zero memory location in HTTP_REQUEST_HANDLE_OBJECT::ReleaseConnection Is this a bug in the actual DLL and not caused by improper usage? wininet!HTTP_REQUEST_HANDLE_OBJECT::ReleaseConnection+0x60 wininet!HTTP_REQUEST_HANDLE_OBJECT::CloseConnection+0x84 winin...

C++ - stl_alloc.h missing on GCC4.4.4 on Fedora 12?

I am in the process of porting an application from a BSD platform onto a Linux box. When compiling, I have found that some of the header files call for <bits/stl_alloc.h>, which is missing from my computer. Does anyone have any idea as to where I can find this and/or why it is missing? I am running a Fedora 12 machine with GCC4.4.4. ...