c++

fail to install boost library

Hi, I am installing boost library from its source boost_1_40_0.tar.bz2 on my Ubuntu 8.10. Following "./bootstrap.sh --prefix=path/to/installation/prefix" and "./bjam install", the compilation is very intensive and my system seems unable to take the burden and abnormally exits. I tried several times. All end in my system aborting. Everyti...

Change the dll dependency on windows.

I have to rename some dlls which are used by some xyz.dll. For xyz.dll I don't have the source code is there a way to change xyz.dll to point to renamed dlls, For DYlibs on Mac I used Install_name_tool. For windows still looking for something, Please suggest. ...

running git 'post-receive' hook with setuid fails

I have a git repository that needs to run a post-receive hook as sudo. The binary that I compiled to test this looks like: #include <stdlib.h> #include <unistd.h> #include <stdio.h> int main() { int ret; ret = setuid(geteuid()); if(!ret) { fprintf(stderr, "error setting uid %d \n", ret); } system("[...comma...

Game engine development question

I am thinking of making a simple game engine for my course final year project. I want it to be modular and expandable so that I can add new parts if I have time. For example I would make a graphics engine that would be completely independent of the other systems, once that was finished I could add a physics engine etc. I would also want ...

Terminate Excel Application using OLE

How can I mannually terminate an excel application using OLE Automation? I would like to do this in some exception handling so that an excel process does not remain running if a function throws an error. Currently I use the below code to open excel: Variant excel = Variant::CreateObject("Excel.Application"); ...

Check if Outlook is installed on PC

Is there a way that I could programatically detect if Microsoft Outlook (any version of it) is installed on the PC. I have to do it in unmanaged c++. ...

How many render targets do low end Pixel Shader 2.0 supporting video cards support?

MRT allows for rendering to multiple texture targets in the pixel shader, but I'm not sure how many targets that is. I'm currently using 3 render targets but I may need as much as 5 (though probably just 4). I think the Radeon 9500s are pretty much entry level ps/vs 2.0 cards but I'm really not sure how many render targets it actually s...

C++: Confusing declaration semantics

Hi, After tring my hand at perl and a little bit of C, I am tring to learn C++ and already i am bogged down by the details and pitfalls. Consider this:- int x = 1; { int x = x; // garbage value of x } int const arr = 3; { int arr[arr]; // i am told this is perfectly valid and declares an array of 3 ints !! } Huh, Why the diffe...

Imagemagick problem when loading a png file

I've compiled the latest version of imagemagick for the mac and I get the assertion below when I load a particular png file. This is a bit of a hassle as it crashes the program in debug mode. Anyone ever seen this before? Any workarounds? Assertion failed: (quantum_info->signature == MagickSignature), function DestroyQuantumInfo, file...

std::string's character reference

I have the following string: index 0 1 2 3 4 5 6 7 std::string myString with the content of "\xff\xff\xff\x00\xff\x0d\x0a\xf5" When I'm refering to myString[3], I get the expected '\x00' value. But when I'm referring to myString[5], I get two values "\x0d\x0a" instead of just '\x0d'...

QComboBox textchange event capture problme

I am developing a QT application on redhat linux, I want to capture Carriage Return press event on QComboBox, I have written Signal for editTextChanged(), it is fired for every key press but not for Enter Key.. Why it is so? If there is any other way to capture carriage return..?? ...

Optimizing a floating point division and conversion operation

I have the following formula float mean = (r+b+g)/3/255.0f; I want to speed it up. There are the following preconditions 0<= mean <= 1 and 0 <= r,g,b <= 255 and r, g, b are unsigned chars so if I try to use the fact that >> 8 is like dividing by 256 and I use something like float mean = (float)(((r+b+g)/3) >> 8); this will al...

final class in c++

class Temp { private: ~Temp() {} friend class Final; }; class Final : virtual public Temp { public: void fun() { cout<<"In base"; } }; class Derived : public Final { }; void main() { Derived obj; obj.fun(); } The above code tries to achieve non-inheritable class (final). But using above code t...

C++ app on SunOS has a memory leak. How to find it?

Hi, i just landed on SunOS: $ uname -a SunOS sunfi95 5.9 Generic_122300-13 sun4u sparc SUNW,Sun-Fire-880 and have Sun studio: $ CC -V CC: Sun C++ 5.8 2005/10/13 How I can find memleaks in code? (dbx is not a option in this case). Valgrind does not work on sparc systems, only one solution that cross my mind is to use some smart lib...

Boost.Any vs. Boost.Variant

Hello, I'm having trouble choosing between Boost.Any and Boost.Variant. When should I use each one? What are the advantages and disadvantages of each? I am basically looking to store some states from external sources. Thanks, Omer ...

Throwing a JavaScript exception from C++ code using Google V8

I'm programming a JavaScript application which accesses some C++ code over Google's V8. Everything works fine, but I couldn't figure out how I can throw a JavaScript exception which can be catched in the JavaScript code from the C++ method. For example, if I have a function in C++ like ... using namespace std; using namespace v8; ... ...

C++ templates and implicit type conversion

I have the following code: #include <iostream> #include "boost/shared_ptr.hpp" using boost::shared_ptr; class Base { public: virtual ~Base() {} virtual void print() = 0; }; template <typename T> class Child : public Base { public: virtual void print() { std::cout << "in Child" << std::endl; } }; class GrandChild : publ...

How to avoid locking key-guard in windows-mobile

Hi, Can any one please help me, How to avoid key-guard lock programmatically in windows mobile. i have an application in that after certain minutes key-guard gets lock. i don't want mobile to get locked when my application is running. please suggest me how to do programmatically.. Thanks Grabit ...

Desktop and application menu freezes after ImpersonateLoggedOnUser

Hi. I use the following to elevate the rights of a c++ windows application: LogonUser() LoadUserProfile() ImpersonateLoggedOnUser() The functions do their work and there is no error. But as soon as I want to interact with my application again (clicking on a menu like "File" "Edit", and even right clicking on the desktop) the applicati...

Cross-platform crash handler

I'm looking for a cross-platform crash handler. Google Breakpad looks promising, but it is sorely lacking any documentation, and requires a reasonable amount of fiddling to actually get going. What is a better alternative? All I need is the ability to reliably record crash dumps, stack traces, and CPU information at the time of a cras...